Documentation
¶
Index ¶
- Constants
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Done(args ...interface{})
- func Donef(format string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func InitGlobalLogger(opts LoggerOpts)
- func LogMessage(message string, level corelog.Level)
- func Print(args ...interface{})
- func PrintBitriseStartedEvent(plan models.WorkflowRunPlan)
- func PrintStepFinishedEvent(params StepFinishedParams)
- func PrintStepStartedEvent(params StepStartedParams)
- func Printf(format string, args ...interface{})
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- type ConsoleLoggerOpts
- type HTTPLogAdaptor
- type Logger
- type LoggerOpts
- type LoggerType
- type MessageFields
- type Producer
- type StepDeprecation
- type StepFinishedParams
- type StepStartedParams
- type StepUpdate
- type UtilsLogAdapter
- func (l *UtilsLogAdapter) EnableDebugLog(enable bool)
- func (l *UtilsLogAdapter) Println()
- func (l *UtilsLogAdapter) TDebugf(format string, v ...interface{})
- func (l *UtilsLogAdapter) TDonef(format string, v ...interface{})
- func (l *UtilsLogAdapter) TErrorf(format string, v ...interface{})
- func (l *UtilsLogAdapter) TInfof(format string, v ...interface{})
- func (l *UtilsLogAdapter) TPrintf(format string, v ...interface{})
- func (l *UtilsLogAdapter) TWarnf(format string, v ...interface{})
Examples ¶
Constants ¶
View Source
const ( JSONLogger = LoggerType(corelog.JSONLogger) ConsoleLogger = LoggerType(corelog.ConsoleLogger) )
View Source
const ( BitriseCLI = Producer(corelog.BitriseCLI) Step = Producer(corelog.Step) )
Variables ¶
This section is empty.
Functions ¶
func PrintBitriseStartedEvent ¶
func PrintBitriseStartedEvent(plan models.WorkflowRunPlan)
func PrintStepFinishedEvent ¶
func PrintStepFinishedEvent(params StepFinishedParams)
func PrintStepStartedEvent ¶
func PrintStepStartedEvent(params StepStartedParams)
Types ¶
type ConsoleLoggerOpts ¶
type ConsoleLoggerOpts struct {
Timestamp bool
}
type HTTPLogAdaptor ¶ added in v2.34.2
type HTTPLogAdaptor struct {
Logger Logger
}
HTTPLogAdaptor adapts the retryablehttp.Logger interface to the log.Logger.
func (*HTTPLogAdaptor) Printf ¶ added in v2.34.2
func (a *HTTPLogAdaptor) Printf(fmtStr string, vars ...interface{})
Printf implements the retryablehttp.Logger interface
type Logger ¶
type Logger interface {
Error(args ...interface{})
Errorf(format string, args ...interface{})
Warn(args ...interface{})
Warnf(format string, args ...interface{})
Info(args ...interface{})
Infof(format string, args ...interface{})
Done(args ...interface{})
Donef(format string, args ...interface{})
Print(args ...interface{})
Printf(format string, args ...interface{})
Debug(args ...interface{})
Debugf(format string, args ...interface{})
LogMessage(message string, level corelog.Level)
PrintBitriseStartedEvent(plan models.WorkflowRunPlan)
PrintStepStartedEvent(params StepStartedParams)
PrintStepFinishedEvent(params StepFinishedParams)
}
Logger ...
Example ¶
package main
import (
"os"
"time"
"github.com/bitrise-io/bitrise/v2/log"
)
func referenceTime() time.Time {
return time.Date(2022, 1, 1, 1, 1, 1, 0, time.UTC)
}
func main() {
var logger log.Logger
logger = log.NewLogger(log.LoggerOpts{
LoggerType: log.ConsoleLogger,
Producer: log.BitriseCLI,
DebugLogEnabled: true,
Writer: os.Stdout,
TimeProvider: referenceTime,
})
logger.Errorf("This is an %s", "error")
logger = log.NewLogger(log.LoggerOpts{
LoggerType: log.JSONLogger,
Producer: log.BitriseCLI,
DebugLogEnabled: true,
Writer: os.Stdout,
TimeProvider: referenceTime,
})
logger.Debug("This is a debug message")
log.InitGlobalLogger(log.LoggerOpts{
LoggerType: log.JSONLogger,
Producer: log.BitriseCLI,
DebugLogEnabled: true,
Writer: os.Stdout,
TimeProvider: referenceTime,
})
log.Info("This is an info message")
}
Output:
type LoggerOpts ¶
type LoggerOpts struct {
LoggerType LoggerType
Producer Producer
ProducerID string
ConsoleLoggerOpts ConsoleLoggerOpts
DebugLogEnabled bool
Writer io.Writer
TimeProvider func() time.Time
}
type LoggerType ¶
type LoggerType corelog.LoggerType
type MessageFields ¶
type MessageFields corelog.MessageLogFields
type StepDeprecation ¶
StepDeprecation ...
type StepFinishedParams ¶
type StepFinishedParams struct {
ExecutionID string `json:"uuid"`
Status string `json:"status"`
StatusReason string `json:"status_reason,omitempty"`
Title string `json:"title"`
RunTime int64 `json:"run_time_in_ms"`
SupportURL string `json:"support_url"`
SourceCodeURL string `json:"source_code_url"`
Errors []models.StepError `json:"errors,omitempty"`
// The update and deprecation fields are pointers because an empty struct is always initialised so never omitted.
Update *StepUpdate `json:"update_available,omitempty"`
Deprecation *StepDeprecation `json:"deprecation,omitempty"`
LastStep bool `json:"last_step"`
}
StepFinishedParams ...
type StepStartedParams ¶
type StepStartedParams struct {
ExecutionID string `json:"uuid"`
Position int `json:"idx"`
Title string `json:"title"`
ID string `json:"id"`
Version string `json:"version"`
Collection string `json:"collection"`
Toolkit string `json:"toolkit"`
StartTime string `json:"start_time"`
}
StepStartedParams ...
type StepUpdate ¶
type StepUpdate struct {
OriginalVersion string `json:"original_version"`
ResolvedVersion string `json:"resolved_version"`
LatestVersion string `json:"latest_version"`
ReleasesURL string `json:"release_notes"`
}
StepUpdate ...
type UtilsLogAdapter ¶
type UtilsLogAdapter struct {
Logger
// contains filtered or unexported fields
}
UtilsLogAdapter extends the bitrise/log.Logger to meet the go-utils/v2/log.Logger interface.
func NewUtilsLogAdapter ¶
func NewUtilsLogAdapter() UtilsLogAdapter
func (*UtilsLogAdapter) EnableDebugLog ¶
func (l *UtilsLogAdapter) EnableDebugLog(enable bool)
func (*UtilsLogAdapter) Println ¶
func (l *UtilsLogAdapter) Println()
func (*UtilsLogAdapter) TDebugf ¶
func (l *UtilsLogAdapter) TDebugf(format string, v ...interface{})
func (*UtilsLogAdapter) TDonef ¶
func (l *UtilsLogAdapter) TDonef(format string, v ...interface{})
func (*UtilsLogAdapter) TErrorf ¶
func (l *UtilsLogAdapter) TErrorf(format string, v ...interface{})
func (*UtilsLogAdapter) TInfof ¶
func (l *UtilsLogAdapter) TInfof(format string, v ...interface{})
func (*UtilsLogAdapter) TPrintf ¶
func (l *UtilsLogAdapter) TPrintf(format string, v ...interface{})
func (*UtilsLogAdapter) TWarnf ¶
func (l *UtilsLogAdapter) TWarnf(format string, v ...interface{})
Source Files
¶
Click to show internal directories.
Click to hide internal directories.