Documentation ¶
Index ¶
- func GetContextWithCorrelation(ctx context.Context, c *CorrelationParam) context.Context
- func GetContextWithCustomerID(ctx context.Context, c *CustomerIdentifier) context.Context
- func GetCorrelationHeader(ctx context.Context) map[string]string
- func SetCorrelationHeader(ctx context.Context, req *http.Request)
- type AuditLogWriter
- type ChanneledLogMux
- type ChanneledLogWriter
- type Config
- type ContextVariable
- type CorrelationParam
- type CustomerIdentifier
- type DefaultLogMux
- type Log
- type LogLevel
- type LogLevelCode
- type LogMessage
- type LogMux
- type LogWriter
- type Logger
- func (l *Logger) AddLogWriter(ctx context.Context, w LogWriter)
- func (l *Logger) Audit(ctx context.Context, msg interface{}) error
- func (l *Logger) Debug(ctx context.Context, message string, logObject ...interface{})
- func (l *Logger) Emergency(ctx context.Context, message string, err error, logObject ...interface{})
- func (l *Logger) Error(ctx context.Context, message string, logObject ...interface{})
- func (l *Logger) Fatal(ctx context.Context, message string, exitCode int, logObject ...interface{})
- func (l *Logger) GetLogLevel() LogLevel
- func (l *Logger) Info(ctx context.Context, message string, logObject ...interface{})
- func (l *Logger) NewResourceLogger(resourceName string) Log
- func (l *Logger) Notice(ctx context.Context, message string, logObject ...interface{})
- func (l *Logger) SetModuleName(moduleName string)
- func (l *Logger) Trace(ctx context.Context, message string, logObject ...interface{})
- func (l *Logger) Warning(ctx context.Context, message string, logObject ...interface{})
- type MuxLogMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetContextWithCorrelation ¶
func GetContextWithCorrelation(ctx context.Context, c *CorrelationParam) context.Context
func GetContextWithCustomerID ¶
func GetContextWithCustomerID(ctx context.Context, c *CustomerIdentifier) context.Context
Types ¶
type AuditLogWriter ¶
type ChanneledLogMux ¶
type ChanneledLogMux struct {
// contains filtered or unexported fields
}
func NewChanneledLogMux ¶
func NewChanneledLogMux(bufferSize uint8, logWriterList ...ChanneledLogWriter) *ChanneledLogMux
func (*ChanneledLogMux) Print ¶
func (ls *ChanneledLogMux) Print(ctx context.Context, msg *LogMessage)
type ChanneledLogWriter ¶
type ChanneledLogWriter interface { Start(chan MuxLogMessage) WriteMessage(context.Context, *LogMessage) error GetBufferSize() int }
type ContextVariable ¶
type ContextVariable string
const ( ContextKeyCorrelation ContextVariable = "correlationParam" ContextKeyCustomerIdentifier ContextVariable = "customerIdentity" )
type CorrelationParam ¶
type CorrelationParam struct { CorrelationID string `header:"x-correlation-id" body:"correlationId"` ScenarioID *string `header:"x-scenario-id,omitempty" body:"scenarioId,omitempty"` SessionID *string `header:"x-session-id,omitempty" body:"sessionId,omitempty"` ScenarioName *string `header:"x-scenario-name,omitempty" body:"scenarioName,omitempty"` }
func GetCorrelationParam ¶
func GetCorrelationParam(ctx context.Context) *CorrelationParam
func GetDefaultCorrelationParam ¶
func GetDefaultCorrelationParam(serviceName string) *CorrelationParam
func (*CorrelationParam) GetHeader ¶
func (c *CorrelationParam) GetHeader() map[string]string
func (*CorrelationParam) GetPayload ¶
func (c *CorrelationParam) GetPayload() map[string]string
func (*CorrelationParam) LoadFromHeader ¶
func (c *CorrelationParam) LoadFromHeader(header map[string]string) error
type CustomerIdentifier ¶
type CustomerIdentifier struct { UserID *string `header:"x-user-id,omitempty" body:"userId,omitempty"` AppUserID *string `header:"x-app-user-id,omitempty" body:"appUserID,omitempty"` EntityID *string `header:"x-entity-id,omitempty" body:"entityId,omitempty"` }
func GetCustomerIdentifier ¶
func GetCustomerIdentifier(ctx context.Context) *CustomerIdentifier
func (*CustomerIdentifier) GetHeader ¶
func (c *CustomerIdentifier) GetHeader() map[string]string
func (*CustomerIdentifier) GetPayload ¶
func (c *CustomerIdentifier) GetPayload() map[string]string
func (*CustomerIdentifier) LoadFromHeader ¶
func (c *CustomerIdentifier) LoadFromHeader(header map[string]string) error
type DefaultLogMux ¶
type DefaultLogMux struct {
// contains filtered or unexported fields
}
func NewDefaultLogMux ¶
func NewDefaultLogMux(logWriterList ...LogWriter) *DefaultLogMux
func (*DefaultLogMux) AddLogWriter ¶
func (ls *DefaultLogMux) AddLogWriter(ctx context.Context, writer LogWriter)
func (*DefaultLogMux) Print ¶
func (ls *DefaultLogMux) Print(ctx context.Context, msg *LogMessage)
type Log ¶
type Log interface { NewResourceLogger(resourceName string) Log Audit(ctx context.Context, msg interface{}) error Trace(ctx context.Context, message string, logObject ...interface{}) Debug(ctx context.Context, message string, logObject ...interface{}) Info(ctx context.Context, message string, logObject ...interface{}) Notice(ctx context.Context, message string, logObject ...interface{}) Warning(ctx context.Context, message string, logObject ...interface{}) Error(ctx context.Context, message string, logObject ...interface{}) Emergency(ctx context.Context, message string, err error, logObject ...interface{}) Fatal(ctx context.Context, message string, exitCode int, logObject ...interface{}) GetLogLevel() LogLevel AddLogWriter(context.Context, LogWriter) }
type LogLevel ¶
type LogLevel struct { Level LogLevelCode LogLevelName string }
func GetLogLevelMap ¶
func GetLogLevelMap(level LogLevelCode) LogLevel
type LogLevelCode ¶
type LogLevelCode uint8
const ( TRACE LogLevelCode = 8 DEBUG LogLevelCode = 7 INFO LogLevelCode = 6 NOTICE LogLevelCode = 5 WARNING LogLevelCode = 4 ERROR LogLevelCode = 3 EMERGENCY LogLevelCode = 2 FATAL LogLevelCode = 0 )
type LogMessage ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func NewWithDefaultConfig ¶
func (*Logger) GetLogLevel ¶
func (*Logger) NewResourceLogger ¶
func (*Logger) SetModuleName ¶
type MuxLogMessage ¶
type MuxLogMessage struct { Ctx context.Context LogMessage LogMessage }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.