From 4a7cf3111a4c2af77bcc1cc68dfb8373a0c7b38b Mon Sep 17 00:00:00 2001 From: jar3b Date: Fri, 29 Jun 2018 00:16:51 +0300 Subject: [PATCH] Update readme --- README.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7b83dd6..1cd3c01 100644 --- a/README.md +++ b/README.md @@ -8,4 +8,23 @@ Logrus (https://github.com/sirupsen/logrus) formatter with messages like Configure -... \ No newline at end of file +``` +import ( + log "github.com/sirupsen/logrus" + "github.com/jar3b/logrus-levelpad-formatter" + "os" +) + +func InitLog() { + log.SetFormatter(&levelpad.Formatter{ + TimestampFormat: "2006-01-02 15:04:05.000", + LogFormat: "[%lvl%][%time%] %msg%\n", + LevelPad: 8, + }) + + log.SetOutput(os.Stdout) + + // Only log the info severity or above. + log.SetLevel(log.InfoLevel) +} +``` \ No newline at end of file