-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathmain.go
More file actions
35 lines (28 loc) · 651 Bytes
/
main.go
File metadata and controls
35 lines (28 loc) · 651 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"io"
"math/rand"
"os"
"time"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/rs/zerolog/pkgerrors"
"github.com/haozibi/leetcode-badge/cmd"
)
const (
timeFormatUnixNano = "2006-01-02 15:04:05.999999999"
)
func New(w io.Writer) {
zerolog.TimeFieldFormat = timeFormatUnixNano
zerolog.ErrorStackMarshaler = pkgerrors.MarshalStack
log.Logger = zerolog.New(&zerolog.ConsoleWriter{
Out: w,
TimeFormat: timeFormatUnixNano,
NoColor: false,
}).With().Stack().CallerWithSkipFrameCount(2).Timestamp().Logger()
}
func main() {
rand.Seed(time.Now().Unix())
New(os.Stdout)
cmd.Execute()
}