mirror of
https://github.com/daeuniverse/dae.git
synced 2025-01-08 06:23:16 +07:00
26 lines
434 B
Go
26 lines
434 B
Go
|
/*
|
||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||
|
* Copyright (c) since 2023, mzz2017 (mzz@tuta.io). All rights reserved.
|
||
|
*/
|
||
|
|
||
|
package logger
|
||
|
|
||
|
import "github.com/sirupsen/logrus"
|
||
|
|
||
|
func NewLogger(verbose int) *logrus.Logger {
|
||
|
log := logrus.New()
|
||
|
|
||
|
var level logrus.Level
|
||
|
switch verbose {
|
||
|
case 0:
|
||
|
level = logrus.WarnLevel
|
||
|
case 1:
|
||
|
level = logrus.InfoLevel
|
||
|
default:
|
||
|
level = logrus.TraceLevel
|
||
|
}
|
||
|
log.SetLevel(level)
|
||
|
|
||
|
return log
|
||
|
}
|