Documentation
¶
Overview ¶
Package sloge implements the functions, types, and interfaces for the module.
Package sloge implements the functions, types, and interfaces for the module.
Package sloge implements the functions, types, and interfaces for the module.
Package sloge implements the functions, types, and interfaces for the module.
Index ¶
- Constants
- Variables
- type Attr
- type Color
- type DevConfig
- type Format
- type Handler
- type HandlerOptions
- type JSONHandler
- type Kind
- type Level
- type LevelVar
- type Leveler
- type LogValuer
- type Logger
- type LumberjackLogger
- type Option
- type Record
- type Setting
- func WithAddSource() Setting
- func WithConsole(set bool) Setting
- func WithConsoleOnly() Setting
- func WithDefault(set bool) Setting
- func WithDevConfig(config *DevConfig) Setting
- func WithFile(file string) Setting
- func WithFormat(format Format) Setting
- func WithLevel(level Leveler) Setting
- func WithLumberjack(config *LumberjackLogger) Setting
- func WithNoColor() Setting
- func WithReplaceAttr(replaceAttr func(groups []string, attr Attr) Attr) Setting
- func WithTimeLayout(timeLayout string) Setting
- type Source
- type TextHandler
- type TintOptions
- type Value
Constants ¶
const ( KindAny = slog.KindAny KindBool = slog.KindBool KindDuration = slog.KindDuration KindFloat64 = slog.KindFloat64 KindGroup = slog.KindGroup KindInt64 = slog.KindInt64 KindLogValuer = slog.KindLogValuer KindString = slog.KindString KindTime = slog.KindTime KindUint64 = slog.KindUint64 LevelDebug = slog.LevelDebug LevelError = slog.LevelError LevelInfo = slog.LevelInfo LevelKey = slog.LevelKey LevelWarn = slog.LevelWarn MessageKey = slog.MessageKey SourceKey = slog.SourceKey TimeKey = slog.TimeKey )
slog is a wrapper around slog
const ( Black = devslog.Black Blue = devslog.Blue Cyan = devslog.Cyan Green = devslog.Green Magenta = devslog.Magenta Red = devslog.Red UnknownColor = devslog.UnknownColor White = devslog.White Yellow = devslog.Yellow )
devslog is a wrapper around devslog
const ( // DefaultTimeLayout the default time layout; DefaultTimeLayout = time.DateTime )
const (
LevelFatal = 12
)
Variables ¶
var ( Any = slog.Any AnyValue = slog.AnyValue Bool = slog.Bool BoolValue = slog.BoolValue Debug = slog.Debug DebugContext = slog.DebugContext Default = slog.Default Duration = slog.Duration DurationValue = slog.DurationValue Error = slog.Error ErrorContext = slog.ErrorContext Float64 = slog.Float64 Float64Value = slog.Float64Value Group = slog.Group GroupValue = slog.GroupValue Info = slog.Info InfoContext = slog.InfoContext Int = slog.Int Int64 = slog.Int64 Int64Value = slog.Int64Value IntValue = slog.IntValue Log = slog.Log LogAttrs = slog.LogAttrs NewJSONHandler = slog.NewJSONHandler NewLogLogger = slog.NewLogLogger NewRecord = slog.NewRecord NewTextHandler = slog.NewTextHandler SetDefault = slog.SetDefault SetLogLoggerLevel = slog.SetLogLoggerLevel String = slog.String StringValue = slog.StringValue Time = slog.Time TimeValue = slog.TimeValue Uint64 = slog.Uint64 Uint64Value = slog.Uint64Value Warn = slog.Warn WarnContext = slog.WarnContext With = slog.With )
var ( Err = tint.Err NewTintHandler = tint.NewHandler )
tint is a wrapper around tint
var ( // NewDevSlogHandler is a wrapper around devslog.NewHandler NewDevSlogHandler = devslog.NewHandler )
Functions ¶
This section is empty.
Types ¶
type LumberjackLogger ¶
type LumberjackLogger = lumberjack.Logger
LumberjackLogger is a wrapper around lumberjack.Logger
type Option ¶
type Option struct {
Output string
Format Format
TimeLayout string
Console bool
Level Leveler
ReplaceAttr func(groups []string, attr Attr) Attr
AddSource bool
LumberjackConfig *LumberjackLogger
DevConfig *DevConfig
NoColor bool
Default bool
}
Option custom setup config
type Setting ¶
type Setting = func(*Option)
func WithConsole ¶
WithConsole set the log to console or /dev/null
func WithConsoleOnly ¶ added in v0.0.7
func WithConsoleOnly() Setting
WithConsoleOnly set the log to console only
func WithLumberjack ¶
func WithLumberjack(config *LumberjackLogger) Setting
WithLumberjack write log to some File with rotation
func WithReplaceAttr ¶
WithReplaceAttr custom replaceAttr
func WithTimeLayout ¶
WithTimeLayout custom time format