-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Switched the internal plugin logger from
fmt
to zerolog
with de…
…fault logging level `zerolog.Disabled` * Added optional parameter of ydb output plugin `LogLevel` (if not defined - plugin logging disabled)
- Loading branch information
1 parent
078e9e9
commit a5f9155
Showing
7 changed files
with
41 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,30 @@ | ||
package log | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
"github.com/rs/zerolog" | ||
"github.com/rs/zerolog/log" | ||
) | ||
|
||
var ( | ||
timeLayout = "2006/01/02 15:04:05" | ||
format = "[%s] [%s] [\x1b[44mydb\u001B[0m] %s\n" | ||
) | ||
func SetLevel(lvl zerolog.Level) { | ||
zerolog.SetGlobalLevel(lvl) | ||
} | ||
|
||
func Debug(msg string) { | ||
fmt.Printf(format, time.Now().Format(timeLayout), "\033[100mdebug\u001B[0m", msg) | ||
log.Debug().Msg(msg) | ||
} | ||
|
||
func Warn(msg string) { | ||
fmt.Printf(format, time.Now().Format(timeLayout), "\u001B[30m\u001B[103m warn\u001B[0m", msg) | ||
log.Warn().Msg(msg) | ||
} | ||
|
||
func Info(msg string) { | ||
fmt.Printf(format, time.Now().Format(timeLayout), "\033[106m info\u001B[0m", msg) | ||
log.Info().Msg(msg) | ||
} | ||
|
||
func Error(msg string) { | ||
fmt.Printf(format, time.Now().Format(timeLayout), "\033[101merror\u001B[0m", msg) | ||
log.Error().Msg(msg) | ||
} | ||
|
||
func Fatal(msg string) { | ||
fmt.Printf(format, time.Now().Format(timeLayout), "\033[101mfatal\u001B[0m", msg) | ||
log.Fatal().Msg(msg) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters