update vendor
This commit is contained in:
parent
212412fe03
commit
f588c76e6c
19
vendor/github.com/go-log/log/LICENSE
generated
vendored
Normal file
19
vendor/github.com/go-log/log/LICENSE
generated
vendored
Normal file
@ -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.
|
63
vendor/github.com/go-log/log/README.md
generated
vendored
Normal file
63
vendor/github.com/go-log/log/README.md
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
# Log [](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),
|
||||
)
|
||||
```
|
30
vendor/github.com/go-log/log/log.go
generated
vendored
Normal file
30
vendor/github.com/go-log/log/log.go
generated
vendored
Normal file
@ -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...)
|
||||
}
|
6
vendor/vendor.json
vendored
6
vendor/vendor.json
vendored
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user