32 lines
838 B
Go
32 lines
838 B
Go
package logwrap
|
|
|
|
const FileName = "tstor.log"
|
|
|
|
// func Load(config *config.Log) {
|
|
// level := slog.LevelInfo
|
|
// if config.Debug {
|
|
// level = slog.LevelDebug
|
|
// }
|
|
|
|
// slog.SetDefault(slog.New(
|
|
// tint.NewHandler(os.Stdout, &tint.Options{
|
|
// Level: level,
|
|
// TimeFormat: time.Kitchen,
|
|
// // NoColor: !isatty.IsTerminal(os.Stdout.Fd()),
|
|
// }),
|
|
// ))
|
|
// }
|
|
|
|
// func newRollingFile(config *config.Log) io.Writer {
|
|
// if err := os.MkdirAll(config.Path, 0744); err != nil {
|
|
// log.Error().Err(err).Str("path", config.Path).Msg("can't create log directory")
|
|
// return nil
|
|
// }
|
|
|
|
// return &lumberjack.Logger{
|
|
// Filename: filepath.Join(config.Path, FileName),
|
|
// MaxBackups: config.MaxBackups, // files
|
|
// MaxSize: config.MaxSize, // megabytes
|
|
// MaxAge: config.MaxAge, // days
|
|
// }
|
|
// }
|