-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update libcontainer to fd6df76562137aa3b18e44b790c
Signed-off-by: Michael Crosby <[email protected]>
- Loading branch information
1 parent
56261da
commit 7f5ebdc
Showing
33 changed files
with
474 additions
and
348 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
vendor/src/github.com/Sirupsen/logrus/formatter_bench_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package logrus | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
) | ||
|
||
// smallFields is a small size data set for benchmarking | ||
var smallFields = Fields{ | ||
"foo": "bar", | ||
"baz": "qux", | ||
"one": "two", | ||
"three": "four", | ||
} | ||
|
||
// largeFields is a large size data set for benchmarking | ||
var largeFields = Fields{ | ||
"foo": "bar", | ||
"baz": "qux", | ||
"one": "two", | ||
"three": "four", | ||
"five": "six", | ||
"seven": "eight", | ||
"nine": "ten", | ||
"eleven": "twelve", | ||
"thirteen": "fourteen", | ||
"fifteen": "sixteen", | ||
"seventeen": "eighteen", | ||
"nineteen": "twenty", | ||
"a": "b", | ||
"c": "d", | ||
"e": "f", | ||
"g": "h", | ||
"i": "j", | ||
"k": "l", | ||
"m": "n", | ||
"o": "p", | ||
"q": "r", | ||
"s": "t", | ||
"u": "v", | ||
"w": "x", | ||
"y": "z", | ||
"this": "will", | ||
"make": "thirty", | ||
"entries": "yeah", | ||
} | ||
|
||
func BenchmarkSmallTextFormatter(b *testing.B) { | ||
doBenchmark(b, &TextFormatter{DisableColors: true}, smallFields) | ||
} | ||
|
||
func BenchmarkLargeTextFormatter(b *testing.B) { | ||
doBenchmark(b, &TextFormatter{DisableColors: true}, largeFields) | ||
} | ||
|
||
func BenchmarkSmallColoredTextFormatter(b *testing.B) { | ||
doBenchmark(b, &TextFormatter{ForceColors: true}, smallFields) | ||
} | ||
|
||
func BenchmarkLargeColoredTextFormatter(b *testing.B) { | ||
doBenchmark(b, &TextFormatter{ForceColors: true}, largeFields) | ||
} | ||
|
||
func BenchmarkSmallJSONFormatter(b *testing.B) { | ||
doBenchmark(b, &JSONFormatter{}, smallFields) | ||
} | ||
|
||
func BenchmarkLargeJSONFormatter(b *testing.B) { | ||
doBenchmark(b, &JSONFormatter{}, largeFields) | ||
} | ||
|
||
func doBenchmark(b *testing.B, formatter Formatter, fields Fields) { | ||
entry := &Entry{ | ||
Time: time.Time{}, | ||
Level: InfoLevel, | ||
Message: "message", | ||
Data: fields, | ||
} | ||
var d []byte | ||
var err error | ||
for i := 0; i < b.N; i++ { | ||
d, err = formatter.Format(entry) | ||
if err != nil { | ||
b.Fatal(err) | ||
} | ||
b.SetBytes(int64(len(d))) | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
vendor/src/github.com/Sirupsen/logrus/hooks/papertrail/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Papertrail Hook for Logrus <img src="http://i.imgur.com/hTeVwmJ.png" width="40" height="40" alt=":walrus:" class="emoji" title=":walrus:" /> | ||
|
||
[Papertrail](https://papertrailapp.com) provides hosted log management. Once stored in Papertrail, you can [group](http://help.papertrailapp.com/kb/how-it-works/groups/) your logs on various dimensions, [search](http://help.papertrailapp.com/kb/how-it-works/search-syntax) them, and trigger [alerts](http://help.papertrailapp.com/kb/how-it-works/alerts). | ||
|
||
In most deployments, you'll want to send logs to Papertrail via their [remote_syslog](http://help.papertrailapp.com/kb/configuration/configuring-centralized-logging-from-text-log-files-in-unix/) daemon, which requires no application-specific configuration. This hook is intended for relatively low-volume logging, likely in managed cloud hosting deployments where installing `remote_syslog` is not possible. | ||
|
||
## Usage | ||
|
||
You can find your Papertrail UDP port on your [Papertrail account page](https://papertrailapp.com/account/destinations). Substitute it below for `YOUR_PAPERTRAIL_UDP_PORT`. | ||
|
||
For `YOUR_APP_NAME`, substitute a short string that will readily identify your application or service in the logs. | ||
|
||
```go | ||
import ( | ||
"log/syslog" | ||
"github.com/Sirupsen/logrus" | ||
"github.com/Sirupsen/logrus/hooks/papertrail" | ||
) | ||
|
||
func main() { | ||
log := logrus.New() | ||
hook, err := logrus_papertrail.NewPapertrailHook("logs.papertrailapp.com", YOUR_PAPERTRAIL_UDP_PORT, YOUR_APP_NAME) | ||
|
||
if err == nil { | ||
log.Hooks.Add(hook) | ||
} | ||
} | ||
``` |
54 changes: 54 additions & 0 deletions
54
vendor/src/github.com/Sirupsen/logrus/hooks/papertrail/papertrail.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package logrus_papertrail | ||
|
||
import ( | ||
"fmt" | ||
"net" | ||
"os" | ||
"time" | ||
|
||
"github.com/Sirupsen/logrus" | ||
) | ||
|
||
const ( | ||
format = "Jan 2 15:04:05" | ||
) | ||
|
||
// PapertrailHook to send logs to a logging service compatible with the Papertrail API. | ||
type PapertrailHook struct { | ||
Host string | ||
Port int | ||
AppName string | ||
UDPConn net.Conn | ||
} | ||
|
||
// NewPapertrailHook creates a hook to be added to an instance of logger. | ||
func NewPapertrailHook(host string, port int, appName string) (*PapertrailHook, error) { | ||
conn, err := net.Dial("udp", fmt.Sprintf("%s:%d", host, port)) | ||
return &PapertrailHook{host, port, appName, conn}, err | ||
} | ||
|
||
// Fire is called when a log event is fired. | ||
func (hook *PapertrailHook) Fire(entry *logrus.Entry) error { | ||
date := time.Now().Format(format) | ||
payload := fmt.Sprintf("<22> %s %s: [%s] %s", date, hook.AppName, entry.Data["level"], entry.Message) | ||
|
||
bytesWritten, err := hook.UDPConn.Write([]byte(payload)) | ||
if err != nil { | ||
fmt.Fprintf(os.Stderr, "Unable to send log line to Papertrail via UDP. Wrote %d bytes before error: %v", bytesWritten, err) | ||
return err | ||
} | ||
|
||
return nil | ||
} | ||
|
||
// Levels returns the available logging levels. | ||
func (hook *PapertrailHook) Levels() []logrus.Level { | ||
return []logrus.Level{ | ||
logrus.PanicLevel, | ||
logrus.FatalLevel, | ||
logrus.ErrorLevel, | ||
logrus.WarnLevel, | ||
logrus.InfoLevel, | ||
logrus.DebugLevel, | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
vendor/src/github.com/Sirupsen/logrus/hooks/papertrail/papertrail_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package logrus_papertrail | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/Sirupsen/logrus" | ||
"github.com/stvp/go-udp-testing" | ||
) | ||
|
||
func TestWritingToUDP(t *testing.T) { | ||
port := 16661 | ||
udp.SetAddr(fmt.Sprintf(":%d", port)) | ||
|
||
hook, err := NewPapertrailHook("localhost", port, "test") | ||
if err != nil { | ||
t.Errorf("Unable to connect to local UDP server.") | ||
} | ||
|
||
log := logrus.New() | ||
log.Hooks.Add(hook) | ||
|
||
udp.ShouldReceive(t, "foo", func() { | ||
log.Info("foo") | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
image: dockercore/libcontainer | ||
script: | ||
# Setup the DockerInDocker environment. | ||
- /dind | ||
- sed -i 's!docker/docker!docker/libcontainer!' /go/src/github.com/docker/docker/hack/make/.validate | ||
- bash /go/src/github.com/docker/docker/hack/make/validate-dco | ||
- bash /go/src/github.com/docker/docker/hack/make/validate-gofmt | ||
- export GOPATH="$GOPATH:/go:$(pwd)/vendor" # Drone mucks with our GOPATH | ||
- make direct-test |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,4 @@ Michael Crosby <[email protected]> (@crosbymichael) | |
Rohit Jnagal <[email protected]> (@rjnagal) | ||
Victor Marmol <[email protected]> (@vmarmol) | ||
Mrunal Patel <[email protected]> (@mrunalp) | ||
.travis.yml: Tianon Gravi <[email protected]> (@tianon) | ||
update-vendor.sh: Tianon Gravi <[email protected]> (@tianon) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.