Release / update-version (push) Has been cancelled
Release / build-frontend (push) Has been cancelled
Release / release (push) Has been cancelled
Release / sync-version-file (push) Has been cancelled
CI / shell (push) Canceled after 0s
CI / test (push) Canceled after 0s
CI / frontend (push) Canceled after 0s
CI / golangci-lint (push) Canceled after 0s
Security Scan / backend-security (push) Canceled after 0s
Security Scan / frontend-security (push) Canceled after 0s
32 lines
867 B
Go
32 lines
867 B
Go
package logger
|
|
|
|
import "github.com/Wei-Shaw/sub2api/internal/config"
|
|
|
|
func OptionsFromConfig(cfg config.LogConfig) InitOptions {
|
|
return InitOptions{
|
|
Level: cfg.Level,
|
|
Format: cfg.Format,
|
|
ServiceName: cfg.ServiceName,
|
|
Environment: cfg.Environment,
|
|
Caller: cfg.Caller,
|
|
StacktraceLevel: cfg.StacktraceLevel,
|
|
Output: OutputOptions{
|
|
ToStdout: cfg.Output.ToStdout,
|
|
ToFile: cfg.Output.ToFile,
|
|
FilePath: cfg.Output.FilePath,
|
|
},
|
|
Rotation: RotationOptions{
|
|
MaxSizeMB: cfg.Rotation.MaxSizeMB,
|
|
MaxBackups: cfg.Rotation.MaxBackups,
|
|
MaxAgeDays: cfg.Rotation.MaxAgeDays,
|
|
Compress: cfg.Rotation.Compress,
|
|
LocalTime: cfg.Rotation.LocalTime,
|
|
},
|
|
Sampling: SamplingOptions{
|
|
Enabled: cfg.Sampling.Enabled,
|
|
Initial: cfg.Sampling.Initial,
|
|
Thereafter: cfg.Sampling.Thereafter,
|
|
},
|
|
}
|
|
}
|