aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/hashicorp/go-hclog/log.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/hashicorp/go-hclog/log.go')
-rw-r--r--vendor/github.com/hashicorp/go-hclog/log.go29
1 files changed, 26 insertions, 3 deletions
diff --git a/vendor/github.com/hashicorp/go-hclog/log.go b/vendor/github.com/hashicorp/go-hclog/log.go
index 6bb16ba..d98714e 100644
--- a/vendor/github.com/hashicorp/go-hclog/log.go
+++ b/vendor/github.com/hashicorp/go-hclog/log.go
@@ -5,6 +5,7 @@ import (
5 "log" 5 "log"
6 "os" 6 "os"
7 "strings" 7 "strings"
8 "sync"
8) 9)
9 10
10var ( 11var (
@@ -12,7 +13,7 @@ var (
12 DefaultLevel = Info 13 DefaultLevel = Info
13) 14)
14 15
15type Level int 16type Level int32
16 17
17const ( 18const (
18 // This is a special level used to indicate that no level has been 19 // This is a special level used to indicate that no level has been
@@ -36,6 +37,18 @@ const (
36 Error Level = 5 37 Error Level = 5
37) 38)
38 39
40// When processing a value of this type, the logger automatically treats the first
41// argument as a Printf formatting string and passes the rest as the values to be
42// formatted. For example: L.Info(Fmt{"%d beans/day", beans}). This is a simple
43// convience type for when formatting is required.
44type Format []interface{}
45
46// Fmt returns a Format type. This is a convience function for creating a Format
47// type.
48func Fmt(str string, args ...interface{}) Format {
49 return append(Format{str}, args...)
50}
51
39// LevelFromString returns a Level type for the named log level, or "NoLevel" if 52// LevelFromString returns a Level type for the named log level, or "NoLevel" if
40// the level string is invalid. This facilitates setting the log level via 53// the level string is invalid. This facilitates setting the log level via
41// config or environment variable by name in a predictable way. 54// config or environment variable by name in a predictable way.
@@ -108,6 +121,10 @@ type Logger interface {
108 // the current name as well. 121 // the current name as well.
109 ResetNamed(name string) Logger 122 ResetNamed(name string) Logger
110 123
124 // Updates the level. This should affect all sub-loggers as well. If an
125 // implementation cannot update the level on the fly, it should no-op.
126 SetLevel(level Level)
127
111 // Return a value that conforms to the stdlib log.Logger interface 128 // Return a value that conforms to the stdlib log.Logger interface
112 StandardLogger(opts *StandardLoggerOptions) *log.Logger 129 StandardLogger(opts *StandardLoggerOptions) *log.Logger
113} 130}
@@ -127,12 +144,18 @@ type LoggerOptions struct {
127 // The threshold for the logger. Anything less severe is supressed 144 // The threshold for the logger. Anything less severe is supressed
128 Level Level 145 Level Level
129 146
130 // Where to write the logs to. Defaults to os.Stdout if nil 147 // Where to write the logs to. Defaults to os.Stderr if nil
131 Output io.Writer 148 Output io.Writer
132 149
150 // An optional mutex pointer in case Output is shared
151 Mutex *sync.Mutex
152
133 // Control if the output should be in JSON. 153 // Control if the output should be in JSON.
134 JSONFormat bool 154 JSONFormat bool
135 155
136 // Intclude file and line information in each log line 156 // Include file and line information in each log line
137 IncludeLocation bool 157 IncludeLocation bool
158
159 // The time format to use instead of the default
160 TimeFormat string
138} 161}