Documentation
¶
Overview ¶
Package log configuration
Index ¶
- Constants
- func ContextWithLogger(ctx context.Context, logger Logger) context.Context
- func NewLogger(level Level, format Format) *logrus.Logger
- func NewLoggerFromConfig(config Config) *logrus.Logger
- func WithLoggerFields(ctx context.Context, fields logrus.Fields) context.Context
- type Config
- type Duration
- type Format
- type Level
- type Logger
- type UnknownFormatError
Constants ¶
View Source
const ( LoggerField = "logger" FieldStack = "stack" FieldTemplateLoader = "template_loader" FieldTemplateName = "template_name" FieldTemplatePart = "template_part" FieldTemplateType = "template_type" FieldTemplateDir = "template_dir" FieldTemplatePath = "template_path" FieldCallbackType = "event_type" FieldTemplateExample = "template_example" FieldDocumentID = "document_id" FieldContentType = "content_type" FieldAssetPath = "asset_path" FieldListenAddr = "listen_addr" FieldDocumentURL = "document_url" FieldBrowserReply = "browser_reply" FieldBrowserEvent = "browser_event" FieldBrowserOut = "browser_out" FieldBrowserState = "browser_state" FieldBrowserData = "browser_data" FieldRenderDataErrors = "render_data_errors" FieldRenderData = "render_data" FieldConfig = "config" FieldDuration = "duration" FieldRequestID = "request_id" FieldRequestIP = "addr" FieldRequestMethod = "method" FieldRequestPath = "path" FieldRequestRoute = "route" FieldRequestQuery = "query" FieldResponseCode = "response_code" FieldResponseSize = "response_size" )
Logger fields.
View Source
const ( LevelTrace = Level(logrus.TraceLevel) LevelDebug = Level(logrus.DebugLevel) LevelInfo = Level(logrus.InfoLevel) LevelWarn = Level(logrus.WarnLevel) LevelError = Level(logrus.ErrorLevel) LevelFatal = Level(logrus.FatalLevel) )
Logger levels.
View Source
const ( TextFormat = Format("text") JSONFormat = Format("json") )
Definition of available log formats.
View Source
const (
ContextKeyRequestID = contextKey("requestID")
)
Context keys.
Variables ¶
This section is empty.
Functions ¶
func ContextWithLogger ¶
ContextWithLogger create new context with logger.
func NewLoggerFromConfig ¶ added in v0.9.0
NewLoggerFromConfig constructor.
Types ¶
type Config ¶ added in v0.9.0
Config defines the configuration of the logger.
func DefaultConfig ¶ added in v0.9.0
func DefaultConfig() Config
DefaultConfig returns the default config.
type Format ¶
type Format string
Format text or json.
func AvailableFormats ¶
func AvailableFormats() []Format
AvailableFormats return list all available log formats.
type Level ¶
Level is logrus.Level wrapper with support flag.Value interface.
func AvailableLevels ¶
func AvailableLevels() []Level
AvailableLevels return all available log levels.
type UnknownFormatError ¶
type UnknownFormatError struct {
// contains filtered or unexported fields
}
UnknownFormatError return by LogFormat.Set when provided unknown format.
func NewUnknownFormatError ¶
func NewUnknownFormatError(value string) *UnknownFormatError
NewUnknownFormatError constructor.
func (*UnknownFormatError) Error ¶
func (err *UnknownFormatError) Error() string
Click to show internal directories.
Click to hide internal directories.