summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/apex/log
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/apex/log')
-rw-r--r--vendor/github.com/apex/log/.gitignore1
-rw-r--r--vendor/github.com/apex/log/History.md75
-rw-r--r--vendor/github.com/apex/log/LICENSE22
-rw-r--r--vendor/github.com/apex/log/Makefile2
-rw-r--r--vendor/github.com/apex/log/Readme.md61
-rw-r--r--vendor/github.com/apex/log/context.go19
-rw-r--r--vendor/github.com/apex/log/default.go45
-rw-r--r--vendor/github.com/apex/log/doc.go10
-rw-r--r--vendor/github.com/apex/log/entry.go182
-rw-r--r--vendor/github.com/apex/log/interface.go22
-rw-r--r--vendor/github.com/apex/log/levels.go81
-rw-r--r--vendor/github.com/apex/log/logger.go156
-rw-r--r--vendor/github.com/apex/log/pkg.go108
-rw-r--r--vendor/github.com/apex/log/stack.go8
14 files changed, 792 insertions, 0 deletions
diff --git a/vendor/github.com/apex/log/.gitignore b/vendor/github.com/apex/log/.gitignore
new file mode 100644
index 00000000..7a6353d6
--- /dev/null
+++ b/vendor/github.com/apex/log/.gitignore
@@ -0,0 +1 @@
+.envrc
diff --git a/vendor/github.com/apex/log/History.md b/vendor/github.com/apex/log/History.md
new file mode 100644
index 00000000..a303177b
--- /dev/null
+++ b/vendor/github.com/apex/log/History.md
@@ -0,0 +1,75 @@
+
+v1.9.0 / 2020-08-18
+===================
+
+ * add `WithDuration()` method to record a duration as milliseconds
+ * add: ignore nil errors in `WithError()`
+ * change trace duration to milliseconds (arguably a breaking change)
+
+v1.8.0 / 2020-08-05
+===================
+
+ * refactor apexlogs handler to not make the AddEvents() call if there are no events to flush
+
+v1.7.1 / 2020-08-05
+===================
+
+ * fix potential nil panic in apexlogs handler
+
+v1.7.0 / 2020-08-03
+===================
+
+ * add FlushSync() to apexlogs handler
+
+v1.6.0 / 2020-07-13
+===================
+
+ * update apex/logs dep to v1.0.0
+ * docs: mention that Flush() is non-blocking now, use Close()
+
+v1.5.0 / 2020-07-11
+===================
+
+ * add buffering to Apex Logs handler
+
+v1.4.0 / 2020-06-16
+===================
+
+ * add AuthToken to apexlogs handler
+
+v1.3.0 / 2020-05-26
+===================
+
+ * change FromContext() to always return a logger
+
+v1.2.0 / 2020-05-26
+===================
+
+ * add log.NewContext() and log.FromContext(). Closes #78
+
+v1.1.4 / 2020-04-22
+===================
+
+ * add apexlogs HTTPClient support
+
+v1.1.3 / 2020-04-22
+===================
+
+ * add events len check before flushing to apexlogs handler
+
+v1.1.2 / 2020-01-29
+===================
+
+ * refactor apexlogs handler to use github.com/apex/logs client
+
+v1.1.1 / 2019-06-24
+===================
+
+ * add go.mod
+ * add rough pass at apexlogs handler
+
+v1.1.0 / 2018-10-11
+===================
+
+ * fix: cli handler to show non-string fields appropriately
+ * fix: cli using fatih/color to better support windows
diff --git a/vendor/github.com/apex/log/LICENSE b/vendor/github.com/apex/log/LICENSE
new file mode 100644
index 00000000..af718006
--- /dev/null
+++ b/vendor/github.com/apex/log/LICENSE
@@ -0,0 +1,22 @@
+(The MIT License)
+
+Copyright (c) 2015 TJ Holowaychuk tj@tjholowaychuk.com
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/github.com/apex/log/Makefile b/vendor/github.com/apex/log/Makefile
new file mode 100644
index 00000000..f948e88e
--- /dev/null
+++ b/vendor/github.com/apex/log/Makefile
@@ -0,0 +1,2 @@
+
+include github.com/tj/make/golang
diff --git a/vendor/github.com/apex/log/Readme.md b/vendor/github.com/apex/log/Readme.md
new file mode 100644
index 00000000..aa5c621f
--- /dev/null
+++ b/vendor/github.com/apex/log/Readme.md
@@ -0,0 +1,61 @@
+
+![Structured logging for golang](assets/title.png)
+
+Package log implements a simple structured logging API inspired by Logrus, designed with centralization in mind. Read more on [Medium](https://medium.com/@tjholowaychuk/apex-log-e8d9627f4a9a#.rav8yhkud).
+
+## Handlers
+
+- __apexlogs__ – handler for [Apex Logs](https://apex.sh/logs/)
+- __cli__ – human-friendly CLI output
+- __discard__ – discards all logs
+- __es__ – Elasticsearch handler
+- __graylog__ – Graylog handler
+- __json__ – JSON output handler
+- __kinesis__ – AWS Kinesis handler
+- __level__ – level filter handler
+- __logfmt__ – logfmt plain-text formatter
+- __memory__ – in-memory handler for tests
+- __multi__ – fan-out to multiple handlers
+- __papertrail__ – Papertrail handler
+- __text__ – human-friendly colored output
+- __delta__ – outputs the delta between log calls and spinner
+
+## Example
+
+Example using the [Apex Logs](https://apex.sh/logs/) handler.
+
+```go
+package main
+
+import (
+ "errors"
+ "time"
+
+ "github.com/apex/log"
+)
+
+func main() {
+ ctx := log.WithFields(log.Fields{
+ "file": "something.png",
+ "type": "image/png",
+ "user": "tobi",
+ })
+
+ for range time.Tick(time.Millisecond * 200) {
+ ctx.Info("upload")
+ ctx.Info("upload complete")
+ ctx.Warn("upload retry")
+ ctx.WithError(errors.New("unauthorized")).Error("upload failed")
+ ctx.Errorf("failed to upload %s", "img.png")
+ }
+}
+```
+
+---
+
+[![Build Status](https://semaphoreci.com/api/v1/projects/d8a8b1c0-45b0-4b89-b066-99d788d0b94c/642077/badge.svg)](https://semaphoreci.com/tj/log)
+[![GoDoc](https://godoc.org/github.com/apex/log?status.svg)](https://godoc.org/github.com/apex/log)
+![](https://img.shields.io/badge/license-MIT-blue.svg)
+![](https://img.shields.io/badge/status-stable-green.svg)
+
+<a href="https://apex.sh"><img src="http://tjholowaychuk.com:6000/svg/sponsor"></a>
diff --git a/vendor/github.com/apex/log/context.go b/vendor/github.com/apex/log/context.go
new file mode 100644
index 00000000..290ae414
--- /dev/null
+++ b/vendor/github.com/apex/log/context.go
@@ -0,0 +1,19 @@
+package log
+
+import "context"
+
+// logKey is a private context key.
+type logKey struct{}
+
+// NewContext returns a new context with logger.
+func NewContext(ctx context.Context, v Interface) context.Context {
+ return context.WithValue(ctx, logKey{}, v)
+}
+
+// FromContext returns the logger from context, or log.Log.
+func FromContext(ctx context.Context) Interface {
+ if v, ok := ctx.Value(logKey{}).(Interface); ok {
+ return v
+ }
+ return Log
+}
diff --git a/vendor/github.com/apex/log/default.go b/vendor/github.com/apex/log/default.go
new file mode 100644
index 00000000..22134862
--- /dev/null
+++ b/vendor/github.com/apex/log/default.go
@@ -0,0 +1,45 @@
+package log
+
+import (
+ "bytes"
+ "fmt"
+ "log"
+ "sort"
+)
+
+// field used for sorting.
+type field struct {
+ Name string
+ Value interface{}
+}
+
+// by sorts fields by name.
+type byName []field
+
+func (a byName) Len() int { return len(a) }
+func (a byName) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
+func (a byName) Less(i, j int) bool { return a[i].Name < a[j].Name }
+
+// handleStdLog outpouts to the stlib log.
+func handleStdLog(e *Entry) error {
+ level := levelNames[e.Level]
+
+ var fields []field
+
+ for k, v := range e.Fields {
+ fields = append(fields, field{k, v})
+ }
+
+ sort.Sort(byName(fields))
+
+ var b bytes.Buffer
+ fmt.Fprintf(&b, "%5s %-25s", level, e.Message)
+
+ for _, f := range fields {
+ fmt.Fprintf(&b, " %s=%v", f.Name, f.Value)
+ }
+
+ log.Println(b.String())
+
+ return nil
+}
diff --git a/vendor/github.com/apex/log/doc.go b/vendor/github.com/apex/log/doc.go
new file mode 100644
index 00000000..0331e8e1
--- /dev/null
+++ b/vendor/github.com/apex/log/doc.go
@@ -0,0 +1,10 @@
+/*
+Package log implements a simple structured logging API designed with few assumptions. Designed for
+centralized logging solutions such as Kinesis which require encoding and decoding before fanning-out
+to handlers.
+
+You may use this package with inline handlers, much like Logrus, however a centralized solution
+is recommended so that apps do not need to be re-deployed to add or remove logging service
+providers.
+*/
+package log
diff --git a/vendor/github.com/apex/log/entry.go b/vendor/github.com/apex/log/entry.go
new file mode 100644
index 00000000..d8982956
--- /dev/null
+++ b/vendor/github.com/apex/log/entry.go
@@ -0,0 +1,182 @@
+package log
+
+import (
+ "fmt"
+ "os"
+ "strings"
+ "time"
+)
+
+// assert interface compliance.
+var _ Interface = (*Entry)(nil)
+
+// Now returns the current time.
+var Now = time.Now
+
+// Entry represents a single log entry.
+type Entry struct {
+ Logger *Logger `json:"-"`
+ Fields Fields `json:"fields"`
+ Level Level `json:"level"`
+ Timestamp time.Time `json:"timestamp"`
+ Message string `json:"message"`
+ start time.Time
+ fields []Fields
+}
+
+// NewEntry returns a new entry for `log`.
+func NewEntry(log *Logger) *Entry {
+ return &Entry{
+ Logger: log,
+ }
+}
+
+// WithFields returns a new entry with `fields` set.
+func (e *Entry) WithFields(fields Fielder) *Entry {
+ f := []Fields{}
+ f = append(f, e.fields...)
+ f = append(f, fields.Fields())
+ return &Entry{
+ Logger: e.Logger,
+ fields: f,
+ }
+}
+
+// WithField returns a new entry with the `key` and `value` set.
+func (e *Entry) WithField(key string, value interface{}) *Entry {
+ return e.WithFields(Fields{key: value})
+}
+
+// WithDuration returns a new entry with the "duration" field set
+// to the given duration in milliseconds.
+func (e *Entry) WithDuration(d time.Duration) *Entry {
+ return e.WithField("duration", d.Milliseconds())
+}
+
+// WithError returns a new entry with the "error" set to `err`.
+//
+// The given error may implement .Fielder, if it does the method
+// will add all its `.Fields()` into the returned entry.
+func (e *Entry) WithError(err error) *Entry {
+ if err == nil {
+ return e
+ }
+
+ ctx := e.WithField("error", err.Error())
+
+ if s, ok := err.(stackTracer); ok {
+ frame := s.StackTrace()[0]
+
+ name := fmt.Sprintf("%n", frame)
+ file := fmt.Sprintf("%+s", frame)
+ line := fmt.Sprintf("%d", frame)
+
+ parts := strings.Split(file, "\n\t")
+ if len(parts) > 1 {
+ file = parts[1]
+ }
+
+ ctx = ctx.WithField("source", fmt.Sprintf("%s: %s:%s", name, file, line))
+ }
+
+ if f, ok := err.(Fielder); ok {
+ ctx = ctx.WithFields(f.Fields())
+ }
+
+ return ctx
+}
+
+// Debug level message.
+func (e *Entry) Debug(msg string) {
+ e.Logger.log(DebugLevel, e, msg)
+}
+
+// Info level message.
+func (e *Entry) Info(msg string) {
+ e.Logger.log(InfoLevel, e, msg)
+}
+
+// Warn level message.
+func (e *Entry) Warn(msg string) {
+ e.Logger.log(WarnLevel, e, msg)
+}
+
+// Error level message.
+func (e *Entry) Error(msg string) {
+ e.Logger.log(ErrorLevel, e, msg)
+}
+
+// Fatal level message, followed by an exit.
+func (e *Entry) Fatal(msg string) {
+ e.Logger.log(FatalLevel, e, msg)
+ os.Exit(1)
+}
+
+// Debugf level formatted message.
+func (e *Entry) Debugf(msg string, v ...interface{}) {
+ e.Debug(fmt.Sprintf(msg, v...))
+}
+
+// Infof level formatted message.
+func (e *Entry) Infof(msg string, v ...interface{}) {
+ e.Info(fmt.Sprintf(msg, v...))
+}
+
+// Warnf level formatted message.
+func (e *Entry) Warnf(msg string, v ...interface{}) {
+ e.Warn(fmt.Sprintf(msg, v...))
+}
+
+// Errorf level formatted message.
+func (e *Entry) Errorf(msg string, v ...interface{}) {
+ e.Error(fmt.Sprintf(msg, v...))
+}
+
+// Fatalf level formatted message, followed by an exit.
+func (e *Entry) Fatalf(msg string, v ...interface{}) {
+ e.Fatal(fmt.Sprintf(msg, v...))
+}
+
+// Trace returns a new entry with a Stop method to fire off
+// a corresponding completion log, useful with defer.
+func (e *Entry) Trace(msg string) *Entry {
+ e.Info(msg)
+ v := e.WithFields(e.Fields)
+ v.Message = msg
+ v.start = time.Now()
+ return v
+}
+
+// Stop should be used with Trace, to fire off the completion message. When
+// an `err` is passed the "error" field is set, and the log level is error.
+func (e *Entry) Stop(err *error) {
+ if err == nil || *err == nil {
+ e.WithDuration(time.Since(e.start)).Info(e.Message)
+ } else {
+ e.WithDuration(time.Since(e.start)).WithError(*err).Error(e.Message)
+ }
+}
+
+// mergedFields returns the fields list collapsed into a single map.
+func (e *Entry) mergedFields() Fields {
+ f := Fields{}
+
+ for _, fields := range e.fields {
+ for k, v := range fields {
+ f[k] = v
+ }
+ }
+
+ return f
+}
+
+// finalize returns a copy of the Entry with Fields merged.
+func (e *Entry) finalize(level Level, msg string) *Entry {
+ return &Entry{
+ Logger: e.Logger,
+ Fields: e.mergedFields(),
+ Level: level,
+ Message: msg,
+ Timestamp: Now(),
+ }
+}
diff --git a/vendor/github.com/apex/log/interface.go b/vendor/github.com/apex/log/interface.go
new file mode 100644
index 00000000..9daa0465
--- /dev/null
+++ b/vendor/github.com/apex/log/interface.go
@@ -0,0 +1,22 @@
+package log
+
+import "time"
+
+// Interface represents the API of both Logger and Entry.
+type Interface interface {
+ WithFields(Fielder) *Entry
+ WithField(string, interface{}) *Entry
+ WithDuration(time.Duration) *Entry
+ WithError(error) *Entry
+ Debug(string)
+ Info(string)
+ Warn(string)
+ Error(string)
+ Fatal(string)
+ Debugf(string, ...interface{})
+ Infof(string, ...interface{})
+ Warnf(string, ...interface{})
+ Errorf(string, ...interface{})
+ Fatalf(string, ...interface{})
+ Trace(string) *Entry
+}
diff --git a/vendor/github.com/apex/log/levels.go b/vendor/github.com/apex/log/levels.go
new file mode 100644
index 00000000..7d43a436
--- /dev/null
+++ b/vendor/github.com/apex/log/levels.go
@@ -0,0 +1,81 @@
+package log
+
+import (
+ "bytes"
+ "errors"
+ "strings"
+)
+
+// ErrInvalidLevel is returned if the severity level is invalid.
+var ErrInvalidLevel = errors.New("invalid level")
+
+// Level of severity.
+type Level int
+
+// Log levels.
+const (
+ InvalidLevel Level = iota - 1
+ DebugLevel
+ InfoLevel
+ WarnLevel
+ ErrorLevel
+ FatalLevel
+)
+
+var levelNames = [...]string{
+ DebugLevel: "debug",
+ InfoLevel: "info",
+ WarnLevel: "warn",
+ ErrorLevel: "error",
+ FatalLevel: "fatal",
+}
+
+var levelStrings = map[string]Level{
+ "debug": DebugLevel,
+ "info": InfoLevel,
+ "warn": WarnLevel,
+ "warning": WarnLevel,
+ "error": ErrorLevel,
+ "fatal": FatalLevel,
+}
+
+// String implementation.
+func (l Level) String() string {
+ return levelNames[l]
+}
+
+// MarshalJSON implementation.
+func (l Level) MarshalJSON() ([]byte, error) {
+ return []byte(`"` + l.String() + `"`), nil
+}
+
+// UnmarshalJSON implementation.
+func (l *Level) UnmarshalJSON(b []byte) error {
+ v, err := ParseLevel(string(bytes.Trim(b, `"`)))
+ if err != nil {
+ return err
+ }
+
+ *l = v
+ return nil
+}
+
+// ParseLevel parses level string.
+func ParseLevel(s string) (Level, error) {
+ l, ok := levelStrings[strings.ToLower(s)]
+ if !ok {
+ return InvalidLevel, ErrInvalidLevel
+ }
+
+ return l, nil
+}
+
+// MustParseLevel parses level string or panics.
+func MustParseLevel(s string) Level {
+ l, err := ParseLevel(s)
+ if err != nil {
+ panic("invalid log level")
+ }
+
+ return l
+}
diff --git a/vendor/github.com/apex/log/logger.go b/vendor/github.com/apex/log/logger.go
new file mode 100644
index 00000000..c7d9b730
--- /dev/null
+++ b/vendor/github.com/apex/log/logger.go
@@ -0,0 +1,156 @@
+package log
+
+import (
+ stdlog "log"
+ "sort"
+ "time"
+)
+
+// assert interface compliance.
+var _ Interface = (*Logger)(nil)
+
+// Fielder is an interface for providing fields to custom types.
+type Fielder interface {
+ Fields() Fields
+}
+
+// Fields represents a map of entry level data used for structured logging.
+type Fields map[string]interface{}
+
+// Fields implements Fielder.
+func (f Fields) Fields() Fields {
+ return f
+}
+
+// Get field value by name.
+func (f Fields) Get(name string) interface{} {
+ return f[name]
+}
+
+// Names returns field names sorted.
+func (f Fields) Names() (v []string) {
+ for k := range f {
+ v = append(v, k)
+ }
+
+ sort.Strings(v)
+ return
+}
+
+// The HandlerFunc type is an adapter to allow the use of ordinary functions as
+// log handlers. If f is a function with the appropriate signature,
+// HandlerFunc(f) is a Handler object that calls f.
+type HandlerFunc func(*Entry) error
+
+// HandleLog calls f(e).
+func (f HandlerFunc) HandleLog(e *Entry) error {
+ return f(e)
+}
+
+// Handler is used to handle log events, outputting them to
+// stdio or sending them to remote services. See the "handlers"
+// directory for implementations.
+//
+// It is left up to Handlers to implement thread-safety.
+type Handler interface {
+ HandleLog(*Entry) error
+}
+
+// Logger represents a logger with configurable Level and Handler.
+type Logger struct {
+ Handler Handler
+ Level Level
+}
+
+// WithFields returns a new entry with `fields` set.
+func (l *Logger) WithFields(fields Fielder) *Entry {
+ return NewEntry(l).WithFields(fields.Fields())
+}
+
+// WithField returns a new entry with the `key` and `value` set.
+//
+// Note that the `key` should not have spaces in it - use camel
+// case or underscores
+func (l *Logger) WithField(key string, value interface{}) *Entry {
+ return NewEntry(l).WithField(key, value)
+}
+
+// WithDuration returns a new entry with the "duration" field set
+// to the given duration in milliseconds.
+func (l *Logger) WithDuration(d time.Duration) *Entry {
+ return NewEntry(l).WithDuration(d)
+}
+
+// WithError returns a new entry with the "error" set to `err`.
+func (l *Logger) WithError(err error) *Entry {
+ return NewEntry(l).WithError(err)
+}
+
+// Debug level message.
+func (l *Logger) Debug(msg string) {
+ NewEntry(l).Debug(msg)
+}
+
+// Info level message.
+func (l *Logger) Info(msg string) {
+ NewEntry(l).Info(msg)
+}
+
+// Warn level message.
+func (l *Logger) Warn(msg string) {
+ NewEntry(l).Warn(msg)
+}
+
+// Error level message.
+func (l *Logger) Error(msg string) {
+ NewEntry(l).Error(msg)
+}
+
+// Fatal level message, followed by an exit.
+func (l *Logger) Fatal(msg string) {
+ NewEntry(l).Fatal(msg)
+}
+
+// Debugf level formatted message.
+func (l *Logger) Debugf(msg string, v ...interface{}) {
+ NewEntry(l).Debugf(msg, v...)
+}
+
+// Infof level formatted message.
+func (l *Logger) Infof(msg string, v ...interface{}) {
+ NewEntry(l).Infof(msg, v...)
+}
+
+// Warnf level formatted message.
+func (l *Logger) Warnf(msg string, v ...interface{}) {
+ NewEntry(l).Warnf(msg, v...)
+}
+
+// Errorf level formatted message.
+func (l *Logger) Errorf(msg string, v ...interface{}) {
+ NewEntry(l).Errorf(msg, v...)
+}
+
+// Fatalf level formatted message, followed by an exit.
+func (l *Logger) Fatalf(msg string, v ...interface{}) {
+ NewEntry(l).Fatalf(msg, v...)
+}
+
+// Trace returns a new entry with a Stop method to fire off
+// a corresponding completion log, useful with defer.
+func (l *Logger) Trace(msg string) *Entry {
+ return NewEntry(l).Trace(msg)
+}
+
+// log the message, invoking the handler. We clone the entry here
+// to bypass the overhead in Entry methods when the level is not
+// met.
+func (l *Logger) log(level Level, e *Entry, msg string) {
+ if level < l.Level {
+ return
+ }
+
+ if err := l.Handler.HandleLog(e.finalize(level, msg)); err != nil {
+ stdlog.Printf("error logging: %s", err)
+ }
+}
diff --git a/vendor/github.com/apex/log/pkg.go b/vendor/github.com/apex/log/pkg.go
new file mode 100644
index 00000000..872eae6c
--- /dev/null
+++ b/vendor/github.com/apex/log/pkg.go
@@ -0,0 +1,108 @@
+package log
+
+import "time"
+
+// singletons ftw?
+var Log Interface = &Logger{
+ Handler: HandlerFunc(handleStdLog),
+ Level: InfoLevel,
+}
+
+// SetHandler sets the handler. This is not thread-safe.
+// The default handler outputs to the stdlib log.
+func SetHandler(h Handler) {
+ if logger, ok := Log.(*Logger); ok {
+ logger.Handler = h
+ }
+}
+
+// SetLevel sets the log level. This is not thread-safe.
+func SetLevel(l Level) {
+ if logger, ok := Log.(*Logger); ok {
+ logger.Level = l
+ }
+}
+
+// SetLevelFromString sets the log level from a string, panicing when invalid. This is not thread-safe.
+func SetLevelFromString(s string) {
+ if logger, ok := Log.(*Logger); ok {
+ logger.Level = MustParseLevel(s)
+ }
+}
+
+// WithFields returns a new entry with `fields` set.
+func WithFields(fields Fielder) *Entry {
+ return Log.WithFields(fields)
+}
+
+// WithField returns a new entry with the `key` and `value` set.
+func WithField(key string, value interface{}) *Entry {
+ return Log.WithField(key, value)
+}
+
+// WithDuration returns a new entry with the "duration" field set
+// to the given duration in milliseconds.
+func WithDuration(d time.Duration) *Entry {
+ return Log.WithDuration(d)
+}
+
+// WithError returns a new entry with the "error" set to `err`.
+func WithError(err error) *Entry {
+ return Log.WithError(err)
+}
+
+// Debug level message.
+func Debug(msg string) {
+ Log.Debug(msg)
+}
+
+// Info level message.
+func Info(msg string) {
+ Log.Info(msg)
+}
+
+// Warn level message.
+func Warn(msg string) {
+ Log.Warn(msg)
+}
+
+// Error level message.
+func Error(msg string) {
+ Log.Error(msg)
+}
+
+// Fatal level message, followed by an exit.
+func Fatal(msg string) {
+ Log.Fatal(msg)
+}
+
+// Debugf level formatted message.
+func Debugf(msg string, v ...interface{}) {
+ Log.Debugf(msg, v...)
+}
+
+// Infof level formatted message.
+func Infof(msg string, v ...interface{}) {
+ Log.Infof(msg, v...)
+}
+
+// Warnf level formatted message.
+func Warnf(msg string, v ...interface{}) {
+ Log.Warnf(msg, v...)
+}
+
+// Errorf level formatted message.
+func Errorf(msg string, v ...interface{}) {
+ Log.Errorf(msg, v...)
+}
+
+// Fatalf level formatted message, followed by an exit.
+func Fatalf(msg string, v ...interface{}) {
+ Log.Fatalf(msg, v...)
+}
+
+// Trace returns a new entry with a Stop method to fire off
+// a corresponding completion log, useful with defer.
+func Trace(msg string) *Entry {
+ return Log.Trace(msg)
+}
diff --git a/vendor/github.com/apex/log/stack.go b/vendor/github.com/apex/log/stack.go
new file mode 100644
index 00000000..57efe326
--- /dev/null
+++ b/vendor/github.com/apex/log/stack.go
@@ -0,0 +1,8 @@
+package log
+
+import "github.com/pkg/errors"
+
+// stackTracer interface.
+type stackTracer interface {
+ StackTrace() errors.StackTrace
+}