Documentation
¶
Index ¶
- func Can(l Logger, capability Capability) bool
- func Debug(l Logger, s string)
- func Error(l Logger, s string)
- func Notice(l Logger, s string)
- func Warning(l Logger, s string)
- type AzurePipelineOpts
- type Capability
- type GitHubOpts
- type GroupLogParams
- type Logger
- type Mute
- func (m *Mute) Capabilities() map[Capability]struct{}
- func (m *Mute) DebugLog(s string)
- func (m *Mute) ErrorLog(s string)
- func (m *Mute) GroupLog(GroupLogParams) (Logger, func())
- func (m *Mute) Log(s string)
- func (m *Mute) NoticeLog(s string)
- func (m *Mute) SetOutput(o io.Writer)
- func (m *Mute) WarningLog(s string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Can ¶
func Can(l Logger, capability Capability) bool
Can tells if the logger has specified logging capability.
func Debug ¶ added in v0.3.0
Debug - emitting debug log. If the given logger doesn't support CapabilityDebugLog, fallbacks to Log.
func Error ¶ added in v0.3.0
Error - emitting error log. If the given logger doesn't support CapabilityErrorLog, fallbacks to Log.
Types ¶
type AzurePipelineOpts ¶
type AzurePipelineOpts = applyOpts[azurePipelineT]
AzurePipelineOpts configures AzurePipeline logger.
func AzurePipelineUseLogIssue ¶ added in v0.2.0
func AzurePipelineUseLogIssue(yes bool) AzurePipelineOpts
AzurePipelineUseLogIssue controls AzurePipeline logger to log with LogIssue command.
type Capability ¶
type Capability int
const ( // CapabilityLog - prints a basic log CapabilityLog Capability = iota // CapabilityColor - prints log with color CapabilityColor // CapabilityDebugLog - emitting debug log CapabilityDebugLog // CapabilityNoticeLog - emitting notice log CapabilityNoticeLog // CapabilityWarningLog - emitting warning log CapabilityWarningLog // CapabilityErrorLog - emitting error log CapabilityErrorLog // CapabilityGroupLog - emitting logs as a group CapabilityGroupLog )
type GitHubOpts ¶
type GitHubOpts = applyOpts[githubActionsT]
GitHubOpts configures GitHubActions logger.
type GroupLogParams ¶
type GroupLogParams struct { // Name - name of the group Name string }
GroupLogParams specifies the parameter for GroupLog.
type Logger ¶
type Logger interface { // SetOutput sets the output of the logger. // This is useful unit testing usage. SetOutput(io.Writer) // Capabilities returns the capabilities of the logger. Capabilities() map[Capability]struct{} // Log - prints a basic log (CapabilityLog) Log(s string) // DebugLog - emitting debug log (CapabilityDebugLog) DebugLog(s string) // NoticeLog - emitting notice log (CapabilityNoticeLog) NoticeLog(s string) // WarningLog - emitting warning log (CapabilityWarningLog) WarningLog(s string) // ErrorLog - emitting error log (CapabilityErrorLog) ErrorLog(s string) // GroupLog - emitting logs as a group (CapabilityGroupLog) GroupLog(params GroupLogParams) (groupLogger Logger, endGroup func()) }
Logger provides improved CI logging output.
func AzurePipeline ¶
func AzurePipeline(opts ...AzurePipelineOpts) Logger
AzurePipeline creates an AzurePipeline logger.
refs: - https://learn.microsoft.com/en-us/azure/devops/pipelines/scripts/logging-commands
func Get ¶
Get returns a logger based on CI environment. If no supported logger defined, a generic logger will be returned.
func GitHubActions ¶
func GitHubActions(opts ...GitHubOpts) Logger
GitHubActions creates a GitHubActions logger.
refs: - https://github.com/actions/toolkit/blob/master/docs/commands.md
func Group ¶ added in v0.2.0
func Group(l Logger, params GroupLogParams) (Logger, func())
Group starts a group logger. If the given logger doesn't support group logging, the original logger will be returned and a noop finish function will be returned.
type Mute ¶
type Mute struct { }
Mute implements all Logger methods by muting output.
func (*Mute) Capabilities ¶
func (m *Mute) Capabilities() map[Capability]struct{}
func (*Mute) GroupLog ¶
func (m *Mute) GroupLog(GroupLogParams) (Logger, func())