Documentation
¶
Index ¶
- Constants
- Variables
- func Debug(args ...any)
- func Error(args ...any)
- func Fatal(args ...any)
- func Fire(f FireHook)
- func Info(args ...any)
- func New(ctx context.Context, opts ...*Options) error
- func Panic(args ...any)
- func SetLevel(level logrus.Level)
- func SetLogger(l *logrus.Logger)
- func SetOutput(writer io.Writer)
- func Trace(args ...any)
- func Warn(args ...any)
- func WithError(err any) *logrus.Entry
- func WithField(key string, value any) *logrus.Entry
- func WithFields(fields types.Fields) *logrus.Entry
- type Config
- type FireHook
- type Options
- func (op *Options) DefaultStatus(status string) *Options
- func (op *Options) Prefix(prefix string) *Options
- func (op *Options) Service(service string) *Options
- func (op *Options) Version(version string) *Options
- func (op *Options) WithMongoCollection(collection *mongo.Collection, fn types.ShouldReportFunc) *Options
- func (op *Options) WithSlackNotifier(token, channel string, fn types.ShouldReportFunc, ...) *Options
- func (op *Options) WithWorkplaceNotifier(token, thread string, fn types.ShouldReportFunc, ...) *Options
Constants ¶
View Source
const ( // DefaultPrefix is the default prefix used when none // is set. DefaultPrefix = "LOGGER" // DefaultStatus is the default status used when none // is set. DefaultStatus = "LOG" )
Variables ¶
View Source
var ( // L is an alias for the standard logrus Logger. L = logrus.New() )
Functions ¶
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config defines the configuration needed for creating a new Logger.
type FireHook ¶
type FireHook struct { Request *http.Request Status int Message string Data any RequestTime time.Time ResponseTime time.Time Latency float64 }
FireHook represents the data needed to log out a message or data for http Requests.
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options is the type used to configure a new config instance.
func (*Options) DefaultStatus ¶
DefaultStatus is the status code for HTTP requests when none is set.
func (*Options) Service ¶
Service is used for Mongo logging, and general stdout logs. This name will correlate to the name of the Mongo database, if WithMongoCollection is called.
func (*Options) WithMongoCollection ¶
func (op *Options) WithMongoCollection(collection *mongo.Collection, fn types.ShouldReportFunc) *Options
WithMongoCollection allows for logging directly to Mongo.
func (*Options) WithSlackNotifier ¶ added in v0.1.0
func (op *Options) WithSlackNotifier(token, channel string, fn types.ShouldReportFunc, formatter types.FormatMessageFunc) *Options
WithSlackNotifier sends errors that have been marked as errors.INTERNAL to a Workplace thread.
func (*Options) WithWorkplaceNotifier ¶
func (op *Options) WithWorkplaceNotifier(token, thread string, fn types.ShouldReportFunc, formatter types.FormatMessageFunc) *Options
WithWorkplaceNotifier sends errors that have been marked as errors.INTERNAL to a Workplace thread.
Click to show internal directories.
Click to hide internal directories.