Documentation ¶
Overview ¶
Package logging provides a logrus logging implementation. Configuration is determined via environment variables upon startup and logging level may be changed at runtime.
Index ¶
Constants ¶
const ( DebugLevel = "debug" InfoLevel = "info" WarningLevel = "warning" ErrorLevel = "error" FatalLevel = "fatal" PanicLevel = "panic" )
Logging level strings.
const ( DebugColor = 10170623 InfoColor = 3581519 WarningColor = 14327864 ErrorColor = 13631488 PanicColor = 13631488 FatalColor = 13631488 )
Logging level color constants.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Interface ¶
type Interface interface { logrus.FieldLogger WrappedLogger() *logrus.Logger UpdateLevel(level string) UpdateDiscordrus() DiscordGoLogf(discordgoLevel, caller int, format string, arguments ...interface{}) }
Interface wraps the logrus.FieldLogger interface and includes custom methods.
type Logger ¶
type Logger struct { *logrus.Entry Location *time.Location DiscordrusWebHookURL string // contains filtered or unexported fields }
Logger wraps a *logrus.Logger instance and provides custom methods.
func New ¶
func New(options ...OptionFunc) *Logger
New returns a new *Logger instance configured with the OptionFunc arguments provided.
func (*Logger) DiscordGoLogf ¶
DiscordGoLogf is an adapter for plugging into DiscordGo's logging system.
func (*Logger) UpdateDiscordrus ¶
func (logger *Logger) UpdateDiscordrus()
UpdateDiscordrus updates the Discordrus integration to use the *Logger configuration.
func (*Logger) UpdateLevel ¶
UpdateLevel allows for runtime updates of the logging level.
func (*Logger) WrappedLogger ¶
WrappedLogger returns the wrapped *logrus.Logger instance.
type OptionFunc ¶
type OptionFunc func(*Logger)
OptionFunc is used to configure options for a *Logger.
func OptionalDiscordrus ¶
func OptionalDiscordrus(webhookURL string) OptionFunc
OptionalDiscordrus returns an OptionFunc to configure a *Logger to use a Discordrus webhook URL.
func OptionalLogLevel ¶
func OptionalLogLevel(logLevel string) OptionFunc
OptionalLogLevel returns an OptionFunc to configure a *Logger log level.
func OptionalOutput ¶
func OptionalOutput(output io.Writer) OptionFunc
OptionalOutput returns an OptionFunc to configure a *Logger to set where log messages should output to.
func OptionalShardID ¶
func OptionalShardID(shardID int) OptionFunc
OptionalShardID returns an OptionFunc to configure a *Logger to include a shardID field.
func OptionalTimezoneLocation ¶
func OptionalTimezoneLocation(timezoneLocation string) OptionFunc
OptionalTimezoneLocation returns an OptionFunc to configure a *Logger timezone location.