package
0.0.0-20200513085925-1d97044de574
Repository: https://github.com/ver13/ava.git
Documentation: pkg.go.dev
# README
logger
Levels
The following table defines the log levels and messages in logger, in decreasing order of severity. The left column lists the log level designation in and the right column provides a brief description of each log level.
Level | Description |
---|---|
Fatal | Severe errors that cause premature termination. |
Expect these to be immediately visible on a status console. | |
Error | Other runtime errors or unexpected conditions. |
Expect these to be immediately visible on a status console. | |
Critical | |
Warn | Use of deprecated APIs, poor use of APIConfig, 'almost' errors, other runtime situations that are undesirable or unexpected, but not necessarily "wrong". |
Expect these to be immediately visible on a status console. | |
Info | Interesting runtime events (startup/shutdown). |
Expect these to be immediately visible on a console, so be conservative and keep to a minimum. | |
Debug | Detailed information on the flow through the system. |
Expect these to be written to logs only. | |
Trace | Most detailed information. |
Expect these to be written to logs only. |
Colors
The supported keys in the :colors keyword list are:
Level | Color |
---|---|
Fatal | Defaults to: Red |
Error | Defaults to: Red |
Critical | Defaults to: LightRed |
Warn | Defaults to: Yellow |
Info | Defaults to: Green |
Debug | Defaults to: Blue |
Trace | Defaults to: Magenta |
See the IO.ANSI module for a list of colors and attributes.
For example, info takes precedence over debug. If your log level is set to info, info, warn, and error will be printed to the console. If your log level is set to warn, only warn and error will be printed.
Types
Type | Format |
---|---|
Text | %[levelName]s:%[name]s:%[message]s%[fields]s\n |
Apache Common | {host} {userIdentifier} {authUserId} [{datetime}] "{method} {request} HTTP/1.0" {responseCode} {bytes} |
Apache Combined | %[host]s - %[user]s %[authUserId]d [%[ASC_TIME]s] "%[method]s %[request]s HTTP/1.0" %[responseCode]d %[bytes]d "%[referrer]s" "%[agent]s" |
Apache Error | [{timestamp}] [{module}:{severity}] [pid {pid}:tid {threadID}] [client: %{client}] %{message} |
RFC3164 | {timestamp} {hostname} {application}[{pid}]: {message} |
RFC5424 | {version} {iso-timestamp} {hostname} {application} {pid} {message-id} {structured-data} {message} |
Common Log File Format | %[host]s - %[user]s %[authUserId]d [%[ASC_TIME]s] "%[method]s %[request]s HTTP/1.0" %[responseCode]d %[bytes]d |
Metadata
In addition to the keys provided by the user via logger.metadata/1, the following extra keys are available to the :metadata list:
Name | Description |
---|---|
host | |
application | The current application |
module | The current module |
function | The current function |
file | The current file |
line | The current line |
pid | The current process identifier |
threadID | |
user | |
authUserId | |
method | |
request | |
responseCode | |
bytes |
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ParseLogFormatterType attempts to convert a string to a LogFormatterType.
ParseLogLevelType attempts to convert a string to a LogLevelType.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Constants
LogFormatterTypeApacheCombinedLog is a LogFormatterType of type ApacheCombinedLog.
LogFormatterTypeApacheCommonLog is a LogFormatterType of type ApacheCommonLog.
LogFormatterTypeApacheErrorLog is a LogFormatterType of type ApacheErrorLog.
LogFormatterTypeCommonLogFileFormat is a LogFormatterType of type CommonLogFileFormat.
LogFormatterTypeJSON is a LogFormatterType of type JSON.
LogFormatterTypeRFC3164Log is a LogFormatterType of type RFC3164Log.
LogFormatterTypeRFC5424Log is a LogFormatterType of type RFC5424Log.
LogFormatterTypeText is a LogFormatterType of type Text.
LogFormatterTypeUnknown is a LogFormatterType of type Unknown.
LogLevelTypeDebug is a LogLevelType of type Debug Debug level.
LogLevelTypeError is a LogLevelType of type Error Error level.
LogLevelTypeFatal is a LogLevelType of type Fatal Fatal level.
LogLevelTypeInfo is a LogLevelType of type Info Info level.
LogLevelTypePanic is a LogLevelType of type Panic Panic level, highest level of severity.
LogLevelTypeTrace is a LogLevelType of type Trace Trace level.
LogLevelTypeUnknown is a LogLevelType of type Unknown.
LogLevelTypeWarn is a LogLevelType of type Warn Warn level.
# Interfaces
logger is the interface for loggers used in the AVA components.
# Type aliases
LogFormatterType x ENUM( Text JSON ApacheCommonLog ApacheCombinedLog ApacheErrorLog RFC3164Log RFC5424Log CommonLogFileFormat Unknown ).
LogLevelType x ENUM( Panic // Panic level, highest level of severity.