diff --git a/vendor/github.com/go-log/log/LICENSE b/vendor/github.com/go-log/log/LICENSE new file mode 100644 index 0000000..0522e07 --- /dev/null +++ b/vendor/github.com/go-log/log/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2017 Go Log + +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/go-log/log/README.md b/vendor/github.com/go-log/log/README.md new file mode 100644 index 0000000..d324632 --- /dev/null +++ b/vendor/github.com/go-log/log/README.md @@ -0,0 +1,63 @@ +# Log [![GoDoc](https://godoc.org/github.com/go-log/log?status.svg)](https://godoc.org/github.com/go-log/log) + +Log is a logging interface for Go. That's it. Pass around the interface. + +## Rationale + +Users want to standardise logging. Sometimes libraries log. We leave the underlying logging implementation to the user +while allowing libraries to log by simply expecting something that satisfies the Logger interface. This leaves +the user free to pre-configure structure, output, etc. + +## Interface + +The interface is minimalistic on purpose + +```go +type Logger interface { + Log(v ...interface{}) + Logf(format string, v ...interface{}) +} +``` + +## Example + +Here's a logger that uses logrus and logs with predefined fields. + +```go +import ( + "github.com/go-log/log" + "github.com/sirupsen/logrus" +) + +type logrusLogger struct { + *logrus.Entry +} + +func (l *logrusLogger) Log(v ...interface{}) { + l.Entry.Print(v...) +} + +func (l *logrusLogger) Logf(format string, v ...interface{}) { + l.Entry.Printf(format, v...) +} + +func WithFields(f logrus.Fields) log.Logger { + return &logrusLogger{logrus.WithFields(f)} +} +``` + +The `WithFields` func returns a struct that satisfies the Logger interface. + +Pre-configure a logger using WithFields and pass it as an option to a library. + +```go +import "github.com/lib/foo" + +l := mylogger.WithFields(logrus.Fields{ + "library": "github.com/lib/foo", +}) + +f := foo.New( + foo.WithLogger(l), +) +``` diff --git a/vendor/github.com/go-log/log/log.go b/vendor/github.com/go-log/log/log.go new file mode 100644 index 0000000..443864f --- /dev/null +++ b/vendor/github.com/go-log/log/log.go @@ -0,0 +1,30 @@ +// Package log provides a log interface +package log + +// Logger is a generic logging interface +type Logger interface { + Log(v ...interface{}) + Logf(format string, v ...interface{}) +} + +var ( + // The global default logger + DefaultLogger Logger = &noOpLogger{} +) + +// noOpLogger is used as a placeholder for the default logger +type noOpLogger struct{} + +func (n *noOpLogger) Log(v ...interface{}) {} + +func (n *noOpLogger) Logf(format string, v ...interface{}) {} + +// Log logs using the default logger +func Log(v ...interface{}) { + DefaultLogger.Log(v...) +} + +// Logf logs formatted using the default logger +func Logf(format string, v ...interface{}) { + DefaultLogger.Logf(format, v...) +} diff --git a/vendor/vendor.json b/vendor/vendor.json index 62cb590..1bd7db6 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -33,6 +33,12 @@ "revision": "f90acb425616767b84789d10e50a6fb652cd1e9a", "revisionTime": "2017-02-05T06:05:58Z" }, + { + "checksumSHA1": "fBx0fqiyrl26gkGo14J9pJ8zB2Y=", + "path": "github.com/go-log/log", + "revision": "37e2e1f19306361e1fc152a1839f1236149cb4e4", + "revisionTime": "2017-05-15T17:08:25Z" + }, { "checksumSHA1": "URsJa4y/sUUw/STmbeYx9EKqaYE=", "path": "github.com/golang/glog",