OSDN Git Service

add package
[bytom/vapor.git] / vendor / github.com / hashicorp / go-hclog / global.go
1 package hclog
2
3 import (
4         "sync"
5 )
6
7 var (
8         protect sync.Once
9         def     Logger
10
11         // The options used to create the Default logger. These are
12         // read only when the Default logger is created, so set them
13         // as soon as the process starts.
14         DefaultOptions = &LoggerOptions{
15                 Level:  DefaultLevel,
16                 Output: DefaultOutput,
17         }
18 )
19
20 // Return a logger that is held globally. This can be a good starting
21 // place, and then you can use .With() and .Name() to create sub-loggers
22 // to be used in more specific contexts.
23 func Default() Logger {
24         protect.Do(func() {
25                 def = New(DefaultOptions)
26         })
27
28         return def
29 }
30
31 // A short alias for Default()
32 func L() Logger {
33         return Default()
34 }