diff options
Diffstat (limited to 'vendor/github.com/hashicorp/go-hclog/global.go')
-rw-r--r-- | vendor/github.com/hashicorp/go-hclog/global.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/go-hclog/global.go b/vendor/github.com/hashicorp/go-hclog/global.go new file mode 100644 index 0000000..55ce439 --- /dev/null +++ b/vendor/github.com/hashicorp/go-hclog/global.go | |||
@@ -0,0 +1,34 @@ | |||
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 | } | ||