Documentation
¶
Index ¶
- Constants
- Variables
- func AttrsFrom(ctx context.Context) []slog.Attr
- func Err(err error) slog.Attr
- func Event(ctx context.Context, log *slog.Logger, name string, attrs ...slog.Attr)
- func Fanout(hs ...slog.Handler) slog.Handler
- func LevelName(l slog.Level) string
- func NewConsoleHandler(w io.Writer, app string, min slog.Leveler, color bool) slog.Handler
- func NewContextHandler(next slog.Handler, redactKeys ...string) slog.Handler
- func NewJSONHandler(w io.Writer, app string, min slog.Leveler) slog.Handler
- func ParseLevel(s string) (slog.Level, error)
- func WithAttrs(ctx context.Context, attrs ...slog.Attr) context.Context
- func WithScope(ctx context.Context) context.Context
- type Config
- type DailyFile
- type DailyFileOptions
- type Inserter
- type Logger
- type MongoConfig
- type Option
Constants ¶
View Source
const ( LevelVerbose = slog.Level(-8) LevelDebug = slog.LevelDebug LevelInfo = slog.LevelInfo LevelWarn = slog.LevelWarn LevelError = slog.LevelError )
View Source
const ( CollectionLogs = "logs" CollectionDAU = "dau" FieldUserID = "userId" FieldEvent = "event" FieldRoute = "route" FieldStatus = "status" Redacted = "[redacted]" )
View Source
const ( DefaultRetentionDays = 90 DefaultBatchSize = 200 DefaultBufferSize = 10000 DefaultFlushInterval = time.Second )
Variables ¶
View Source
var DefaultRedactKeys = []string{
"password", "newPassword", "currentPassword", "oldPassword", "confirmPassword", "passwordHash", "hash",
"authorization", "cookie", "set-cookie", "token", "accessToken", "refreshToken", "idToken",
"x-user-token", "x-refresh-token", "serviceToken", "secret", "clientSecret", "apiKey", "x-api-key",
"privateKey", "otp",
}
Functions ¶
func NewConsoleHandler ¶
func NewContextHandler ¶
Types ¶
type Config ¶
type Config struct {
LogDirectory string `json:"logDirectory"`
ZippedArchive bool `json:"zippedArchive"`
MinimumLogLevel string `json:"minimumLogLevel" validate:"omitempty,oneof=error warn info debug verbose"`
LogToFile bool `json:"logToFile"`
LogToConsole bool `json:"logToConsole"`
MaxFiles int `json:"maxFiles" validate:"min=0"`
ConsoleColor *bool `json:"consoleColor,omitempty"`
LogToMongo bool `json:"logToMongo"`
Mongo MongoConfig `json:"mongo"`
RedactKeys []string `json:"redactKeys"`
}
func DefaultConfig ¶
func DefaultConfig() Config
type DailyFile ¶
type DailyFile struct {
// contains filtered or unexported fields
}
func NewDailyFile ¶
func NewDailyFile(o DailyFileOptions) (*DailyFile, error)
type DailyFileOptions ¶
type MongoConfig ¶ added in v0.2.0
Click to show internal directories.
Click to hide internal directories.