Documentation
¶
Index ¶
Constants ¶
View Source
const ( // LogTypeLog is normal log type LogTypeLog = "log" // LogTypeRequest is Request log type LogTypeRequest = "request" // LogTypeUserAudits is User Audit log type LogTypeUserAudits = "UserAuditsLog" // LogTypeUserDiagnostics is User Diagnostic log type LogTypeUserDiagnostics = "UserDiagnosticsLog" LogCategory_UserAudits = "UserAudits" LogCategory_UserDiagnostics = "UserDiagnostics" )
Variables ¶
View Source
var CoaVersion string = "unknown"
Functions ¶
func ApplyOptionsToLoggers ¶
ApplyOptionsToLoggers applys options to all registered loggers
func GetCoaVersion ¶
func GetCoaVersion() string
Types ¶
type LogLevel ¶
type LogLevel string
LogLevel is Coa Logger Level type
const ( // DebugLevel has verbose message DebugLevel LogLevel = "debug" // InfoLevel is default log level InfoLevel LogLevel = "info" // WarnLevel is for logging messages about possible issues WarnLevel LogLevel = "warn" // ErrorLevel is for logging errors ErrorLevel LogLevel = "error" // FatalLevel is for logging fatal messages. The system shuts down after logging the message. FatalLevel LogLevel = "fatal" // UndefinedLevel is for undefined log level UndefinedLevel LogLevel = "undefined" )
type Logger ¶
type Logger interface { // EnableJSONOutput enables JSON formatted output log EnableJSONOutput(enabled bool) // SetAppID sets dapr_id field in the log. Default value is empty string SetAppID(id string) // SetOutputLevel sets log output level SetOutputLevel(outputLevel LogLevel) // WithLogType specify the log_type field in log. Default value is LogTypeLog WithLogType(logType string) Logger // Info logs a message at level Info. InfoCtx(ctx context.Context, args ...interface{}) // Infof logs a message at level Info. InfofCtx(ctx context.Context, format string, args ...interface{}) // Debug logs a message at level Debug. DebugCtx(ctx context.Context, args ...interface{}) // Debugf logs a message at level Debug. DebugfCtx(ctx context.Context, format string, args ...interface{}) // Warn logs a message at level Warn. WarnCtx(ctx context.Context, args ...interface{}) // Warnf logs a message at level Warn. WarnfCtx(ctx context.Context, format string, args ...interface{}) // Error logs a message at level Error. ErrorCtx(ctx context.Context, args ...interface{}) // Errorf logs a message at level Error. ErrorfCtx(ctx context.Context, format string, args ...interface{}) // Fatal logs a message at level Fatal then the process will exit with status set to 1. FatalCtx(ctx context.Context, args ...interface{}) // Fatalf logs a message at level Fatal then the process will exit with status set to 1. FatalfCtx(ctx context.Context, format string, args ...interface{}) // Info logs a message at level Info. Info(args ...interface{}) // Infof logs a message at level Info. Infof(format string, args ...interface{}) // Debug logs a message at level Debug. Debug(args ...interface{}) // Debugf logs a message at level Debug. Debugf(format string, args ...interface{}) // Warn logs a message at level Warn. Warn(args ...interface{}) // Warnf logs a message at level Warn. Warnf(format string, args ...interface{}) // Error logs a message at level Error. Error(args ...interface{}) // Errorf logs a message at level Error. Errorf(format string, args ...interface{}) // Fatal logs a message at level Fatal then the process will exit with status set to 1. Fatal(args ...interface{}) // Fatalf logs a message at level Fatal then the process will exit with status set to 1. Fatalf(format string, args ...interface{}) }
Logger includes the logging api sets
func GetGlobalUserAuditsLogger ¶
func GetGlobalUserAuditsLogger() Logger
func GetGlobalUserDiagnosticsLogger ¶
func GetGlobalUserDiagnosticsLogger() Logger
type Options ¶
type Options struct { // JSONFormatEnabled is the flag to enable JSON formatted log JSONFormatEnabled bool // OutputLevel is the level of logging OutputLevel string // contains filtered or unexported fields }
Options defines the sets of options for Coa logging
func DefaultOptions ¶
func DefaultOptions() Options
DefaultOptions returns default values of Options
func (*Options) AttachCmdFlags ¶
func (o *Options) AttachCmdFlags( stringVar func(p *string, name string, value string, usage string), boolVar func(p *bool, name string, value bool, usage string))
AttachCmdFlags attaches log options to command flags
func (*Options) SetOutputLevel ¶
SetOutputLevel sets the log output level
type RetentionBuffer ¶
type RetentionBuffer struct {
// contains filtered or unexported fields
}
func NewRetentionBuffer ¶
func NewRetentionBuffer(maxSize int) *RetentionBuffer
func (*RetentionBuffer) Bytes ¶
func (rb *RetentionBuffer) Bytes() []byte
Click to show internal directories.
Click to hide internal directories.