Browse code

Update logrus to v1.0.1

Fixes case sensitivity issue

Signed-off-by: Derek McGowan <derek@mcgstyle.net>

Derek McGowan authored on 2017/07/27 06:42:13
Showing 243 changed files
... ...
@@ -4,10 +4,10 @@ import (
4 4
 	"net/http"
5 5
 	"strings"
6 6
 
7
-	"github.com/Sirupsen/logrus"
8 7
 	"github.com/docker/docker/api/types"
9 8
 	"github.com/docker/docker/api/types/versions"
10 9
 	"github.com/gorilla/mux"
10
+	"github.com/sirupsen/logrus"
11 11
 	"google.golang.org/grpc"
12 12
 	"google.golang.org/grpc/codes"
13 13
 )
... ...
@@ -7,7 +7,7 @@ import (
7 7
 	"net/http"
8 8
 	"strings"
9 9
 
10
-	"github.com/Sirupsen/logrus"
10
+	"github.com/sirupsen/logrus"
11 11
 	"golang.org/x/net/context"
12 12
 )
13 13
 
... ...
@@ -1,9 +1,9 @@
1 1
 package server
2 2
 
3 3
 import (
4
-	"github.com/Sirupsen/logrus"
5 4
 	"github.com/docker/docker/api/server/httputils"
6 5
 	"github.com/docker/docker/api/server/middleware"
6
+	"github.com/sirupsen/logrus"
7 7
 )
8 8
 
9 9
 // handlerWithGlobalMiddlewares wraps the handler function for a request with
... ...
@@ -3,7 +3,7 @@ package middleware
3 3
 import (
4 4
 	"net/http"
5 5
 
6
-	"github.com/Sirupsen/logrus"
6
+	"github.com/sirupsen/logrus"
7 7
 	"golang.org/x/net/context"
8 8
 )
9 9
 
... ...
@@ -7,9 +7,9 @@ import (
7 7
 	"net/http"
8 8
 	"strings"
9 9
 
10
-	"github.com/Sirupsen/logrus"
11 10
 	"github.com/docker/docker/api/server/httputils"
12 11
 	"github.com/docker/docker/pkg/ioutils"
12
+	"github.com/sirupsen/logrus"
13 13
 	"golang.org/x/net/context"
14 14
 )
15 15
 
... ...
@@ -12,7 +12,6 @@ import (
12 12
 	"strings"
13 13
 	"sync"
14 14
 
15
-	"github.com/Sirupsen/logrus"
16 15
 	apierrors "github.com/docker/docker/api/errors"
17 16
 	"github.com/docker/docker/api/server/httputils"
18 17
 	"github.com/docker/docker/api/types"
... ...
@@ -24,6 +23,7 @@ import (
24 24
 	"github.com/docker/docker/pkg/streamformatter"
25 25
 	units "github.com/docker/go-units"
26 26
 	"github.com/pkg/errors"
27
+	"github.com/sirupsen/logrus"
27 28
 	"golang.org/x/net/context"
28 29
 )
29 30
 
... ...
@@ -8,7 +8,6 @@ import (
8 8
 	"strconv"
9 9
 	"syscall"
10 10
 
11
-	"github.com/Sirupsen/logrus"
12 11
 	"github.com/docker/docker/api"
13 12
 	"github.com/docker/docker/api/server/httputils"
14 13
 	"github.com/docker/docker/api/types"
... ...
@@ -19,6 +18,7 @@ import (
19 19
 	containerpkg "github.com/docker/docker/container"
20 20
 	"github.com/docker/docker/pkg/ioutils"
21 21
 	"github.com/docker/docker/pkg/signal"
22
+	"github.com/sirupsen/logrus"
22 23
 	"golang.org/x/net/context"
23 24
 	"golang.org/x/net/websocket"
24 25
 )
... ...
@@ -7,11 +7,11 @@ import (
7 7
 	"net/http"
8 8
 	"strconv"
9 9
 
10
-	"github.com/Sirupsen/logrus"
11 10
 	"github.com/docker/docker/api/server/httputils"
12 11
 	"github.com/docker/docker/api/types"
13 12
 	"github.com/docker/docker/api/types/versions"
14 13
 	"github.com/docker/docker/pkg/stdcopy"
14
+	"github.com/sirupsen/logrus"
15 15
 	"golang.org/x/net/context"
16 16
 )
17 17
 
... ...
@@ -6,7 +6,6 @@ import (
6 6
 	"net/http"
7 7
 	"strconv"
8 8
 
9
-	"github.com/Sirupsen/logrus"
10 9
 	"github.com/docker/docker/api/errors"
11 10
 	"github.com/docker/docker/api/server/httputils"
12 11
 	basictypes "github.com/docker/docker/api/types"
... ...
@@ -14,6 +13,7 @@ import (
14 14
 	"github.com/docker/docker/api/types/filters"
15 15
 	types "github.com/docker/docker/api/types/swarm"
16 16
 	"github.com/docker/docker/api/types/versions"
17
+	"github.com/sirupsen/logrus"
17 18
 	"golang.org/x/net/context"
18 19
 )
19 20
 
... ...
@@ -6,7 +6,6 @@ import (
6 6
 	"net/http"
7 7
 	"time"
8 8
 
9
-	"github.com/Sirupsen/logrus"
10 9
 	"github.com/docker/docker/api"
11 10
 	"github.com/docker/docker/api/errors"
12 11
 	"github.com/docker/docker/api/server/httputils"
... ...
@@ -18,6 +17,7 @@ import (
18 18
 	"github.com/docker/docker/api/types/versions"
19 19
 	"github.com/docker/docker/pkg/ioutils"
20 20
 	pkgerrors "github.com/pkg/errors"
21
+	"github.com/sirupsen/logrus"
21 22
 	"golang.org/x/net/context"
22 23
 )
23 24
 
... ...
@@ -7,7 +7,6 @@ import (
7 7
 	"net/http"
8 8
 	"strings"
9 9
 
10
-	"github.com/Sirupsen/logrus"
11 10
 	"github.com/docker/docker/api/errors"
12 11
 	"github.com/docker/docker/api/server/httputils"
13 12
 	"github.com/docker/docker/api/server/middleware"
... ...
@@ -15,6 +14,7 @@ import (
15 15
 	"github.com/docker/docker/api/server/router/debug"
16 16
 	"github.com/docker/docker/dockerversion"
17 17
 	"github.com/gorilla/mux"
18
+	"github.com/sirupsen/logrus"
18 19
 	"golang.org/x/net/context"
19 20
 )
20 21
 
... ...
@@ -9,7 +9,6 @@ import (
9 9
 	"strings"
10 10
 	"time"
11 11
 
12
-	"github.com/Sirupsen/logrus"
13 12
 	"github.com/docker/docker/api/types"
14 13
 	"github.com/docker/docker/api/types/backend"
15 14
 	"github.com/docker/docker/api/types/container"
... ...
@@ -26,6 +25,7 @@ import (
26 26
 	"github.com/docker/docker/pkg/system"
27 27
 	"github.com/moby/buildkit/session"
28 28
 	"github.com/pkg/errors"
29
+	"github.com/sirupsen/logrus"
29 30
 	"golang.org/x/net/context"
30 31
 	"golang.org/x/sync/syncmap"
31 32
 )
... ...
@@ -4,13 +4,13 @@ import (
4 4
 	"fmt"
5 5
 	"io"
6 6
 
7
-	"github.com/Sirupsen/logrus"
8 7
 	"github.com/docker/docker/api/types"
9 8
 	"github.com/docker/docker/api/types/container"
10 9
 	"github.com/docker/docker/builder"
11 10
 	containerpkg "github.com/docker/docker/container"
12 11
 	"github.com/docker/docker/pkg/stringid"
13 12
 	"github.com/pkg/errors"
13
+	"github.com/sirupsen/logrus"
14 14
 	"golang.org/x/net/context"
15 15
 )
16 16
 
... ...
@@ -17,7 +17,6 @@ import (
17 17
 	"strings"
18 18
 	"time"
19 19
 
20
-	"github.com/Sirupsen/logrus"
21 20
 	"github.com/docker/docker/api"
22 21
 	"github.com/docker/docker/api/types/container"
23 22
 	"github.com/docker/docker/api/types/strslice"
... ...
@@ -29,6 +28,7 @@ import (
29 29
 	"github.com/docker/docker/pkg/system"
30 30
 	"github.com/docker/go-connections/nat"
31 31
 	"github.com/pkg/errors"
32
+	"github.com/sirupsen/logrus"
32 33
 )
33 34
 
34 35
 // ENV foo bar
... ...
@@ -4,12 +4,12 @@ import (
4 4
 	"strconv"
5 5
 	"strings"
6 6
 
7
-	"github.com/Sirupsen/logrus"
8 7
 	"github.com/docker/docker/api/types/backend"
9 8
 	"github.com/docker/docker/builder"
10 9
 	"github.com/docker/docker/builder/remotecontext"
11 10
 	dockerimage "github.com/docker/docker/image"
12 11
 	"github.com/pkg/errors"
12
+	"github.com/sirupsen/logrus"
13 13
 	"golang.org/x/net/context"
14 14
 )
15 15
 
... ...
@@ -1,9 +1,9 @@
1 1
 package dockerfile
2 2
 
3 3
 import (
4
-	"github.com/Sirupsen/logrus"
5 4
 	"github.com/docker/docker/api/types/container"
6 5
 	"github.com/docker/docker/builder"
6
+	"github.com/sirupsen/logrus"
7 7
 )
8 8
 
9 9
 // ImageProber exposes an Image cache to the Builder. It supports resetting a
... ...
@@ -8,7 +8,6 @@ import (
8 8
 	"sync"
9 9
 	"time"
10 10
 
11
-	"github.com/Sirupsen/logrus"
12 11
 	"github.com/boltdb/bolt"
13 12
 	"github.com/docker/docker/builder"
14 13
 	"github.com/docker/docker/builder/remotecontext"
... ...
@@ -16,6 +15,7 @@ import (
16 16
 	"github.com/docker/docker/pkg/stringid"
17 17
 	"github.com/moby/buildkit/session/filesync"
18 18
 	"github.com/pkg/errors"
19
+	"github.com/sirupsen/logrus"
19 20
 	"github.com/tonistiigi/fsutil"
20 21
 	"golang.org/x/net/context"
21 22
 	"golang.org/x/sync/singleflight"
... ...
@@ -8,7 +8,6 @@ import (
8 8
 	"path/filepath"
9 9
 	"strings"
10 10
 
11
-	"github.com/Sirupsen/logrus"
12 11
 	"github.com/docker/docker/api/types/backend"
13 12
 	"github.com/docker/docker/builder"
14 13
 	"github.com/docker/docker/builder/dockerfile/parser"
... ...
@@ -17,6 +16,7 @@ import (
17 17
 	"github.com/docker/docker/pkg/symlink"
18 18
 	"github.com/docker/docker/pkg/urlutil"
19 19
 	"github.com/pkg/errors"
20
+	"github.com/sirupsen/logrus"
20 21
 )
21 22
 
22 23
 // ClientSessionRemote is identifier for client-session context transport
... ...
@@ -3,7 +3,7 @@ package debug
3 3
 import (
4 4
 	"os"
5 5
 
6
-	"github.com/Sirupsen/logrus"
6
+	"github.com/sirupsen/logrus"
7 7
 )
8 8
 
9 9
 // Enable sets the DEBUG env var to true
... ...
@@ -4,7 +4,7 @@ import (
4 4
 	"os"
5 5
 	"testing"
6 6
 
7
-	"github.com/Sirupsen/logrus"
7
+	"github.com/sirupsen/logrus"
8 8
 )
9 9
 
10 10
 func TestEnable(t *testing.T) {
... ...
@@ -9,7 +9,6 @@ import (
9 9
 	"strings"
10 10
 	"time"
11 11
 
12
-	"github.com/Sirupsen/logrus"
13 12
 	"github.com/docker/distribution/uuid"
14 13
 	"github.com/docker/docker/api"
15 14
 	apiserver "github.com/docker/docker/api/server"
... ...
@@ -51,6 +50,7 @@ import (
51 51
 	swarmapi "github.com/docker/swarmkit/api"
52 52
 	"github.com/moby/buildkit/session"
53 53
 	"github.com/pkg/errors"
54
+	"github.com/sirupsen/logrus"
54 55
 	"github.com/spf13/pflag"
55 56
 )
56 57
 
... ...
@@ -3,10 +3,10 @@ package main
3 3
 import (
4 4
 	"testing"
5 5
 
6
-	"github.com/Sirupsen/logrus"
7 6
 	"github.com/docker/docker/daemon/config"
8 7
 	"github.com/docker/docker/pkg/testutil"
9 8
 	"github.com/docker/docker/pkg/testutil/tempfile"
9
+	"github.com/sirupsen/logrus"
10 10
 	"github.com/spf13/pflag"
11 11
 	"github.com/stretchr/testify/assert"
12 12
 	"github.com/stretchr/testify/require"
... ...
@@ -6,9 +6,9 @@ import (
6 6
 	"os"
7 7
 	"path/filepath"
8 8
 
9
-	"github.com/Sirupsen/logrus"
10 9
 	"github.com/docker/docker/libcontainerd"
11 10
 	"github.com/docker/docker/pkg/system"
11
+	"github.com/sirupsen/logrus"
12 12
 	"golang.org/x/sys/windows"
13 13
 )
14 14
 
... ...
@@ -6,12 +6,12 @@ import (
6 6
 	"path/filepath"
7 7
 	"runtime"
8 8
 
9
-	"github.com/Sirupsen/logrus"
10 9
 	"github.com/docker/docker/cli"
11 10
 	"github.com/docker/docker/daemon/config"
12 11
 	"github.com/docker/docker/dockerversion"
13 12
 	"github.com/docker/docker/pkg/reexec"
14 13
 	"github.com/docker/docker/pkg/term"
14
+	"github.com/sirupsen/logrus"
15 15
 	"github.com/spf13/cobra"
16 16
 )
17 17
 
... ...
@@ -4,8 +4,8 @@ import (
4 4
 	"net"
5 5
 	"net/http"
6 6
 
7
-	"github.com/Sirupsen/logrus"
8 7
 	metrics "github.com/docker/go-metrics"
8
+	"github.com/sirupsen/logrus"
9 9
 )
10 10
 
11 11
 func startMetricsServer(addr string) error {
... ...
@@ -5,11 +5,11 @@ import (
5 5
 	"os"
6 6
 	"path/filepath"
7 7
 
8
-	"github.com/Sirupsen/logrus"
9 8
 	cliconfig "github.com/docker/docker/cli/config"
10 9
 	"github.com/docker/docker/daemon/config"
11 10
 	"github.com/docker/docker/opts"
12 11
 	"github.com/docker/go-connections/tlsconfig"
12
+	"github.com/sirupsen/logrus"
13 13
 	"github.com/spf13/pflag"
14 14
 )
15 15
 
... ...
@@ -12,8 +12,8 @@ import (
12 12
 	"time"
13 13
 	"unsafe"
14 14
 
15
-	"github.com/Sirupsen/logrus"
16 15
 	"github.com/docker/docker/pkg/system"
16
+	"github.com/sirupsen/logrus"
17 17
 	"github.com/spf13/pflag"
18 18
 	"golang.org/x/sys/windows"
19 19
 	"golang.org/x/sys/windows/svc"
... ...
@@ -15,7 +15,6 @@ import (
15 15
 	"syscall"
16 16
 	"time"
17 17
 
18
-	"github.com/Sirupsen/logrus"
19 18
 	containertypes "github.com/docker/docker/api/types/container"
20 19
 	mounttypes "github.com/docker/docker/api/types/mount"
21 20
 	networktypes "github.com/docker/docker/api/types/network"
... ...
@@ -44,6 +43,7 @@ import (
44 44
 	"github.com/docker/libnetwork/options"
45 45
 	"github.com/docker/libnetwork/types"
46 46
 	agentexec "github.com/docker/swarmkit/agent/exec"
47
+	"github.com/sirupsen/logrus"
47 48
 	"golang.org/x/net/context"
48 49
 )
49 50
 
... ...
@@ -9,7 +9,6 @@ import (
9 9
 	"path/filepath"
10 10
 	"strings"
11 11
 
12
-	"github.com/Sirupsen/logrus"
13 12
 	"github.com/docker/docker/api/types"
14 13
 	containertypes "github.com/docker/docker/api/types/container"
15 14
 	mounttypes "github.com/docker/docker/api/types/mount"
... ...
@@ -20,6 +19,7 @@ import (
20 20
 	"github.com/docker/docker/pkg/system"
21 21
 	"github.com/docker/docker/volume"
22 22
 	"github.com/opencontainers/selinux/go-selinux/label"
23
+	"github.com/sirupsen/logrus"
23 24
 	"golang.org/x/sys/unix"
24 25
 )
25 26
 
... ...
@@ -1,8 +1,8 @@
1 1
 package container
2 2
 
3 3
 import (
4
-	"github.com/Sirupsen/logrus"
5 4
 	"github.com/docker/docker/api/types"
5
+	"github.com/sirupsen/logrus"
6 6
 )
7 7
 
8 8
 // Health holds the current container health-check state
... ...
@@ -3,7 +3,7 @@ package container
3 3
 import (
4 4
 	"time"
5 5
 
6
-	"github.com/Sirupsen/logrus"
6
+	"github.com/sirupsen/logrus"
7 7
 )
8 8
 
9 9
 const (
... ...
@@ -6,10 +6,10 @@ import (
6 6
 
7 7
 	"golang.org/x/net/context"
8 8
 
9
-	"github.com/Sirupsen/logrus"
10 9
 	"github.com/docker/docker/pkg/pools"
11 10
 	"github.com/docker/docker/pkg/promise"
12 11
 	"github.com/docker/docker/pkg/term"
12
+	"github.com/sirupsen/logrus"
13 13
 )
14 14
 
15 15
 var defaultEscapeSequence = []byte{16, 17} // ctrl-p, ctrl-q
... ...
@@ -7,11 +7,11 @@ import (
7 7
 	"strings"
8 8
 	"sync"
9 9
 
10
-	"github.com/Sirupsen/logrus"
11 10
 	"github.com/docker/docker/libcontainerd"
12 11
 	"github.com/docker/docker/pkg/broadcaster"
13 12
 	"github.com/docker/docker/pkg/ioutils"
14 13
 	"github.com/docker/docker/pkg/pools"
14
+	"github.com/sirupsen/logrus"
15 15
 )
16 16
 
17 17
 // Config holds information about I/O streams managed together.
... ...
@@ -6,11 +6,11 @@ import (
6 6
 	"strings"
7 7
 	"time"
8 8
 
9
-	"github.com/Sirupsen/logrus"
10 9
 	"github.com/docker/docker/api/types"
11 10
 	"github.com/docker/docker/api/types/network"
12 11
 	"github.com/docker/go-connections/nat"
13 12
 	"github.com/hashicorp/go-memdb"
13
+	"github.com/sirupsen/logrus"
14 14
 )
15 15
 
16 16
 const (
... ...
@@ -11,9 +11,9 @@ import (
11 11
 	"strconv"
12 12
 	"strings"
13 13
 
14
-	"github.com/Sirupsen/logrus"
15 14
 	"github.com/docker/docker/daemon/graphdriver/devmapper"
16 15
 	"github.com/docker/docker/pkg/devicemapper"
16
+	"github.com/sirupsen/logrus"
17 17
 )
18 18
 
19 19
 func usage() {
... ...
@@ -5,7 +5,6 @@ import (
5 5
 	"fmt"
6 6
 	"io"
7 7
 
8
-	"github.com/Sirupsen/logrus"
9 8
 	"github.com/docker/docker/api/errors"
10 9
 	"github.com/docker/docker/api/types/backend"
11 10
 	"github.com/docker/docker/container"
... ...
@@ -13,6 +12,7 @@ import (
13 13
 	"github.com/docker/docker/daemon/logger"
14 14
 	"github.com/docker/docker/pkg/stdcopy"
15 15
 	"github.com/docker/docker/pkg/term"
16
+	"github.com/sirupsen/logrus"
16 17
 )
17 18
 
18 19
 // ContainerAttach attaches to logs according to the config passed in. See ContainerAttachConfig.
... ...
@@ -4,7 +4,6 @@ import (
4 4
 	"io"
5 5
 	"runtime"
6 6
 
7
-	"github.com/Sirupsen/logrus"
8 7
 	"github.com/docker/distribution/reference"
9 8
 	"github.com/docker/docker/api/types"
10 9
 	"github.com/docker/docker/api/types/backend"
... ...
@@ -15,6 +14,7 @@ import (
15 15
 	"github.com/docker/docker/pkg/stringid"
16 16
 	"github.com/docker/docker/registry"
17 17
 	"github.com/pkg/errors"
18
+	"github.com/sirupsen/logrus"
18 19
 	"golang.org/x/net/context"
19 20
 )
20 21
 
... ...
@@ -1,9 +1,9 @@
1 1
 package daemon
2 2
 
3 3
 import (
4
-	"github.com/Sirupsen/logrus"
5 4
 	"github.com/docker/docker/builder"
6 5
 	"github.com/docker/docker/image/cache"
6
+	"github.com/sirupsen/logrus"
7 7
 )
8 8
 
9 9
 // MakeImageCache creates a stateful image cache.
... ...
@@ -46,7 +46,6 @@ import (
46 46
 	"sync"
47 47
 	"time"
48 48
 
49
-	"github.com/Sirupsen/logrus"
50 49
 	"github.com/docker/docker/api/types/network"
51 50
 	types "github.com/docker/docker/api/types/swarm"
52 51
 	"github.com/docker/docker/daemon/cluster/controllers/plugin"
... ...
@@ -56,6 +55,7 @@ import (
56 56
 	swarmapi "github.com/docker/swarmkit/api"
57 57
 	swarmnode "github.com/docker/swarmkit/node"
58 58
 	"github.com/pkg/errors"
59
+	"github.com/sirupsen/logrus"
59 60
 	"golang.org/x/net/context"
60 61
 )
61 62
 
... ...
@@ -5,7 +5,6 @@ import (
5 5
 	"io/ioutil"
6 6
 	"net/http"
7 7
 
8
-	"github.com/Sirupsen/logrus"
9 8
 	"github.com/docker/distribution/reference"
10 9
 	enginetypes "github.com/docker/docker/api/types"
11 10
 	"github.com/docker/docker/api/types/swarm/runtime"
... ...
@@ -14,6 +13,7 @@ import (
14 14
 	"github.com/docker/swarmkit/api"
15 15
 	"github.com/gogo/protobuf/proto"
16 16
 	"github.com/pkg/errors"
17
+	"github.com/sirupsen/logrus"
17 18
 	"golang.org/x/net/context"
18 19
 )
19 20
 
... ...
@@ -9,13 +9,13 @@ import (
9 9
 	"testing"
10 10
 	"time"
11 11
 
12
-	"github.com/Sirupsen/logrus"
13 12
 	"github.com/docker/distribution/reference"
14 13
 	enginetypes "github.com/docker/docker/api/types"
15 14
 	"github.com/docker/docker/api/types/swarm/runtime"
16 15
 	"github.com/docker/docker/pkg/pubsub"
17 16
 	"github.com/docker/docker/plugin"
18 17
 	"github.com/docker/docker/plugin/v2"
18
+	"github.com/sirupsen/logrus"
19 19
 	"golang.org/x/net/context"
20 20
 )
21 21
 
... ...
@@ -5,12 +5,12 @@ import (
5 5
 	"fmt"
6 6
 	"strings"
7 7
 
8
-	"github.com/Sirupsen/logrus"
9 8
 	container "github.com/docker/docker/api/types/container"
10 9
 	mounttypes "github.com/docker/docker/api/types/mount"
11 10
 	types "github.com/docker/docker/api/types/swarm"
12 11
 	swarmapi "github.com/docker/swarmkit/api"
13 12
 	gogotypes "github.com/gogo/protobuf/types"
13
+	"github.com/sirupsen/logrus"
14 14
 )
15 15
 
16 16
 func containerSpecFromGRPC(c *swarmapi.ContainerSpec) *types.ContainerSpec {
... ...
@@ -12,7 +12,6 @@ import (
12 12
 	"syscall"
13 13
 	"time"
14 14
 
15
-	"github.com/Sirupsen/logrus"
16 15
 	"github.com/docker/distribution/reference"
17 16
 	"github.com/docker/docker/api/types"
18 17
 	"github.com/docker/docker/api/types/backend"
... ...
@@ -28,6 +27,7 @@ import (
28 28
 	"github.com/docker/swarmkit/log"
29 29
 	gogotypes "github.com/gogo/protobuf/types"
30 30
 	"github.com/opencontainers/go-digest"
31
+	"github.com/sirupsen/logrus"
31 32
 	"golang.org/x/net/context"
32 33
 	"golang.org/x/time/rate"
33 34
 )
... ...
@@ -8,7 +8,7 @@ import (
8 8
 	"strings"
9 9
 	"time"
10 10
 
11
-	"github.com/Sirupsen/logrus"
11
+	"github.com/sirupsen/logrus"
12 12
 
13 13
 	"github.com/docker/distribution/reference"
14 14
 	"github.com/docker/docker/api/types"
... ...
@@ -5,7 +5,6 @@ import (
5 5
 	"sort"
6 6
 	"strings"
7 7
 
8
-	"github.com/Sirupsen/logrus"
9 8
 	"github.com/docker/docker/api/types"
10 9
 	"github.com/docker/docker/api/types/filters"
11 10
 	"github.com/docker/docker/api/types/network"
... ...
@@ -19,6 +18,7 @@ import (
19 19
 	"github.com/docker/swarmkit/agent/exec"
20 20
 	"github.com/docker/swarmkit/api"
21 21
 	"github.com/docker/swarmkit/api/naming"
22
+	"github.com/sirupsen/logrus"
22 23
 	"golang.org/x/net/context"
23 24
 )
24 25
 
... ...
@@ -3,7 +3,6 @@ package cluster
3 3
 import (
4 4
 	"fmt"
5 5
 
6
-	"github.com/Sirupsen/logrus"
7 6
 	apierrors "github.com/docker/docker/api/errors"
8 7
 	apitypes "github.com/docker/docker/api/types"
9 8
 	"github.com/docker/docker/api/types/network"
... ...
@@ -12,6 +11,7 @@ import (
12 12
 	"github.com/docker/docker/runconfig"
13 13
 	swarmapi "github.com/docker/swarmkit/api"
14 14
 	"github.com/pkg/errors"
15
+	"github.com/sirupsen/logrus"
15 16
 	"golang.org/x/net/context"
16 17
 )
17 18
 
... ...
@@ -8,13 +8,13 @@ import (
8 8
 	"sync"
9 9
 	"time"
10 10
 
11
-	"github.com/Sirupsen/logrus"
12 11
 	types "github.com/docker/docker/api/types/swarm"
13 12
 	"github.com/docker/docker/daemon/cluster/executor/container"
14 13
 	lncluster "github.com/docker/libnetwork/cluster"
15 14
 	swarmapi "github.com/docker/swarmkit/api"
16 15
 	swarmnode "github.com/docker/swarmkit/node"
17 16
 	"github.com/pkg/errors"
17
+	"github.com/sirupsen/logrus"
18 18
 	"golang.org/x/net/context"
19 19
 	"google.golang.org/grpc"
20 20
 )
... ...
@@ -10,7 +10,6 @@ import (
10 10
 	"strings"
11 11
 	"time"
12 12
 
13
-	"github.com/Sirupsen/logrus"
14 13
 	"github.com/docker/distribution/reference"
15 14
 	apierrors "github.com/docker/docker/api/errors"
16 15
 	apitypes "github.com/docker/docker/api/types"
... ...
@@ -22,6 +21,7 @@ import (
22 22
 	swarmapi "github.com/docker/swarmkit/api"
23 23
 	gogotypes "github.com/gogo/protobuf/types"
24 24
 	"github.com/pkg/errors"
25
+	"github.com/sirupsen/logrus"
25 26
 	"golang.org/x/net/context"
26 27
 )
27 28
 
... ...
@@ -6,7 +6,6 @@ import (
6 6
 	"strings"
7 7
 	"time"
8 8
 
9
-	"github.com/Sirupsen/logrus"
10 9
 	apierrors "github.com/docker/docker/api/errors"
11 10
 	apitypes "github.com/docker/docker/api/types"
12 11
 	"github.com/docker/docker/api/types/filters"
... ...
@@ -18,6 +17,7 @@ import (
18 18
 	"github.com/docker/swarmkit/manager/encryption"
19 19
 	swarmnode "github.com/docker/swarmkit/node"
20 20
 	"github.com/pkg/errors"
21
+	"github.com/sirupsen/logrus"
21 22
 	"golang.org/x/net/context"
22 23
 )
23 24
 
... ...
@@ -12,13 +12,13 @@ import (
12 12
 	"strings"
13 13
 	"sync"
14 14
 
15
-	"github.com/Sirupsen/logrus"
16 15
 	daemondiscovery "github.com/docker/docker/daemon/discovery"
17 16
 	"github.com/docker/docker/opts"
18 17
 	"github.com/docker/docker/pkg/authorization"
19 18
 	"github.com/docker/docker/pkg/discovery"
20 19
 	"github.com/docker/docker/registry"
21 20
 	"github.com/imdario/mergo"
21
+	"github.com/sirupsen/logrus"
22 22
 	"github.com/spf13/pflag"
23 23
 )
24 24
 
... ...
@@ -1,8 +1,8 @@
1 1
 package daemon
2 2
 
3 3
 import (
4
-	"github.com/Sirupsen/logrus"
5 4
 	swarmtypes "github.com/docker/docker/api/types/swarm"
5
+	"github.com/sirupsen/logrus"
6 6
 )
7 7
 
8 8
 // SetContainerConfigReferences sets the container config references needed
... ...
@@ -10,7 +10,6 @@ import (
10 10
 	"strings"
11 11
 	"time"
12 12
 
13
-	"github.com/Sirupsen/logrus"
14 13
 	derr "github.com/docker/docker/api/errors"
15 14
 	containertypes "github.com/docker/docker/api/types/container"
16 15
 	networktypes "github.com/docker/docker/api/types/network"
... ...
@@ -24,6 +23,7 @@ import (
24 24
 	"github.com/docker/libnetwork/netlabel"
25 25
 	"github.com/docker/libnetwork/options"
26 26
 	"github.com/docker/libnetwork/types"
27
+	"github.com/sirupsen/logrus"
27 28
 )
28 29
 
29 30
 var (
... ...
@@ -11,7 +11,6 @@ import (
11 11
 	"strconv"
12 12
 	"time"
13 13
 
14
-	"github.com/Sirupsen/logrus"
15 14
 	"github.com/docker/docker/container"
16 15
 	"github.com/docker/docker/daemon/links"
17 16
 	"github.com/docker/docker/pkg/idtools"
... ...
@@ -21,6 +20,7 @@ import (
21 21
 	"github.com/docker/libnetwork"
22 22
 	"github.com/opencontainers/selinux/go-selinux/label"
23 23
 	"github.com/pkg/errors"
24
+	"github.com/sirupsen/logrus"
24 25
 	"golang.org/x/sys/unix"
25 26
 )
26 27
 
... ...
@@ -5,11 +5,11 @@ import (
5 5
 	"io/ioutil"
6 6
 	"os"
7 7
 
8
-	"github.com/Sirupsen/logrus"
9 8
 	"github.com/docker/docker/container"
10 9
 	"github.com/docker/docker/pkg/system"
11 10
 	"github.com/docker/libnetwork"
12 11
 	"github.com/pkg/errors"
12
+	"github.com/sirupsen/logrus"
13 13
 )
14 14
 
15 15
 func (daemon *Daemon) setupLinkedContainers(container *container.Container) ([]string, error) {
... ...
@@ -9,7 +9,6 @@ import (
9 9
 
10 10
 	"github.com/pkg/errors"
11 11
 
12
-	"github.com/Sirupsen/logrus"
13 12
 	apierrors "github.com/docker/docker/api/errors"
14 13
 	"github.com/docker/docker/api/types"
15 14
 	containertypes "github.com/docker/docker/api/types/container"
... ...
@@ -22,6 +21,7 @@ import (
22 22
 	"github.com/docker/docker/pkg/system"
23 23
 	"github.com/docker/docker/runconfig"
24 24
 	"github.com/opencontainers/selinux/go-selinux/label"
25
+	"github.com/sirupsen/logrus"
25 26
 )
26 27
 
27 28
 // CreateManagedContainer creates a container that is managed by a Service
... ...
@@ -7,12 +7,12 @@ import (
7 7
 	"os"
8 8
 	"path/filepath"
9 9
 
10
-	"github.com/Sirupsen/logrus"
11 10
 	containertypes "github.com/docker/docker/api/types/container"
12 11
 	mounttypes "github.com/docker/docker/api/types/mount"
13 12
 	"github.com/docker/docker/container"
14 13
 	"github.com/docker/docker/pkg/stringid"
15 14
 	"github.com/opencontainers/selinux/go-selinux/label"
15
+	"github.com/sirupsen/logrus"
16 16
 )
17 17
 
18 18
 // createContainerPlatformSpecificSettings performs platform specific container create functionality
... ...
@@ -18,7 +18,6 @@ import (
18 18
 	"sync"
19 19
 	"time"
20 20
 
21
-	"github.com/Sirupsen/logrus"
22 21
 	containerd "github.com/containerd/containerd/api/grpc/types"
23 22
 	"github.com/docker/docker/api"
24 23
 	"github.com/docker/docker/api/types"
... ...
@@ -31,6 +30,7 @@ import (
31 31
 	"github.com/docker/docker/daemon/exec"
32 32
 	"github.com/docker/docker/daemon/logger"
33 33
 	"github.com/docker/docker/opts"
34
+	"github.com/sirupsen/logrus"
34 35
 	// register graph drivers
35 36
 	_ "github.com/docker/docker/daemon/graphdriver/register"
36 37
 	"github.com/docker/docker/daemon/initlayer"
... ...
@@ -8,9 +8,9 @@ import (
8 8
 	"regexp"
9 9
 	"strings"
10 10
 
11
-	"github.com/Sirupsen/logrus"
12 11
 	"github.com/docker/docker/pkg/fileutils"
13 12
 	"github.com/docker/docker/pkg/mount"
13
+	"github.com/sirupsen/logrus"
14 14
 )
15 15
 
16 16
 // On Linux, plugins use a static path for storing execution state,
... ...
@@ -7,7 +7,6 @@ import (
7 7
 	"net"
8 8
 	"strconv"
9 9
 
10
-	"github.com/Sirupsen/logrus"
11 10
 	"github.com/docker/docker/api/types"
12 11
 	containertypes "github.com/docker/docker/api/types/container"
13 12
 	"github.com/docker/docker/container"
... ...
@@ -27,6 +26,7 @@ import (
27 27
 	"github.com/opencontainers/runtime-spec/specs-go"
28 28
 	"github.com/opencontainers/selinux/go-selinux/label"
29 29
 	"github.com/pkg/errors"
30
+	"github.com/sirupsen/logrus"
30 31
 )
31 32
 
32 33
 //#include <zone.h>
... ...
@@ -16,7 +16,6 @@ import (
16 16
 	"strings"
17 17
 	"time"
18 18
 
19
-	"github.com/Sirupsen/logrus"
20 19
 	"github.com/docker/docker/api/types"
21 20
 	"github.com/docker/docker/api/types/blkiodev"
22 21
 	pblkiodev "github.com/docker/docker/api/types/blkiodev"
... ...
@@ -44,6 +43,7 @@ import (
44 44
 	specs "github.com/opencontainers/runtime-spec/specs-go"
45 45
 	"github.com/opencontainers/selinux/go-selinux/label"
46 46
 	"github.com/pkg/errors"
47
+	"github.com/sirupsen/logrus"
47 48
 	"github.com/vishvananda/netlink"
48 49
 	"golang.org/x/sys/unix"
49 50
 )
... ...
@@ -8,7 +8,6 @@ import (
8 8
 	"syscall"
9 9
 
10 10
 	"github.com/Microsoft/hcsshim"
11
-	"github.com/Sirupsen/logrus"
12 11
 	"github.com/docker/docker/api/types"
13 12
 	containertypes "github.com/docker/docker/api/types/container"
14 13
 	"github.com/docker/docker/container"
... ...
@@ -28,6 +27,7 @@ import (
28 28
 	"github.com/docker/libnetwork/netlabel"
29 29
 	"github.com/docker/libnetwork/options"
30 30
 	blkiodev "github.com/opencontainers/runc/libcontainer/configs"
31
+	"github.com/sirupsen/logrus"
31 32
 	"golang.org/x/sys/windows"
32 33
 )
33 34
 
... ...
@@ -6,8 +6,8 @@ import (
6 6
 	"os"
7 7
 	"os/signal"
8 8
 
9
-	"github.com/Sirupsen/logrus"
10 9
 	stackdump "github.com/docker/docker/pkg/signal"
10
+	"github.com/sirupsen/logrus"
11 11
 	"golang.org/x/sys/unix"
12 12
 )
13 13
 
... ...
@@ -6,9 +6,9 @@ import (
6 6
 	"unsafe"
7 7
 
8 8
 	winio "github.com/Microsoft/go-winio"
9
-	"github.com/Sirupsen/logrus"
10 9
 	"github.com/docker/docker/pkg/signal"
11 10
 	"github.com/docker/docker/pkg/system"
11
+	"github.com/sirupsen/logrus"
12 12
 	"golang.org/x/sys/windows"
13 13
 )
14 14
 
... ...
@@ -7,7 +7,6 @@ import (
7 7
 	"strings"
8 8
 	"time"
9 9
 
10
-	"github.com/Sirupsen/logrus"
11 10
 	apierrors "github.com/docker/docker/api/errors"
12 11
 	"github.com/docker/docker/api/types"
13 12
 	"github.com/docker/docker/container"
... ...
@@ -15,6 +14,7 @@ import (
15 15
 	"github.com/docker/docker/pkg/system"
16 16
 	volumestore "github.com/docker/docker/volume/store"
17 17
 	"github.com/pkg/errors"
18
+	"github.com/sirupsen/logrus"
18 19
 )
19 20
 
20 21
 // ContainerRm removes the container id from the filesystem. An error
... ...
@@ -6,8 +6,8 @@ import (
6 6
 	"strconv"
7 7
 	"time"
8 8
 
9
-	"github.com/Sirupsen/logrus"
10 9
 	"github.com/docker/docker/pkg/discovery"
10
+	"github.com/sirupsen/logrus"
11 11
 
12 12
 	// Register the libkv backends for discovery.
13 13
 	_ "github.com/docker/docker/pkg/discovery/kv"
... ...
@@ -6,13 +6,13 @@ import (
6 6
 
7 7
 	"golang.org/x/net/context"
8 8
 
9
-	"github.com/Sirupsen/logrus"
10 9
 	"github.com/docker/docker/api/types"
11 10
 	"github.com/docker/docker/api/types/filters"
12 11
 	"github.com/docker/docker/layer"
13 12
 	"github.com/docker/docker/pkg/directory"
14 13
 	"github.com/docker/docker/volume"
15 14
 	"github.com/opencontainers/go-digest"
15
+	"github.com/sirupsen/logrus"
16 16
 )
17 17
 
18 18
 func (daemon *Daemon) getLayerRefs(platform string) map[layer.ChainID]int {
... ...
@@ -6,7 +6,6 @@ import (
6 6
 	"strings"
7 7
 	"time"
8 8
 
9
-	"github.com/Sirupsen/logrus"
10 9
 	"github.com/docker/docker/api/types/events"
11 10
 	"github.com/docker/docker/api/types/filters"
12 11
 	"github.com/docker/docker/container"
... ...
@@ -14,6 +13,7 @@ import (
14 14
 	"github.com/docker/libnetwork"
15 15
 	swarmapi "github.com/docker/swarmkit/api"
16 16
 	gogotypes "github.com/gogo/protobuf/types"
17
+	"github.com/sirupsen/logrus"
17 18
 )
18 19
 
19 20
 var (
... ...
@@ -8,7 +8,6 @@ import (
8 8
 
9 9
 	"golang.org/x/net/context"
10 10
 
11
-	"github.com/Sirupsen/logrus"
12 11
 	"github.com/docker/docker/api/errors"
13 12
 	"github.com/docker/docker/api/types"
14 13
 	"github.com/docker/docker/api/types/strslice"
... ...
@@ -19,6 +18,7 @@ import (
19 19
 	"github.com/docker/docker/pkg/pools"
20 20
 	"github.com/docker/docker/pkg/signal"
21 21
 	"github.com/docker/docker/pkg/term"
22
+	"github.com/sirupsen/logrus"
22 23
 )
23 24
 
24 25
 // Seconds to wait after sending TERM before trying KILL
... ...
@@ -4,10 +4,10 @@ import (
4 4
 	"runtime"
5 5
 	"sync"
6 6
 
7
-	"github.com/Sirupsen/logrus"
8 7
 	"github.com/docker/docker/container/stream"
9 8
 	"github.com/docker/docker/libcontainerd"
10 9
 	"github.com/docker/docker/pkg/stringid"
10
+	"github.com/sirupsen/logrus"
11 11
 )
12 12
 
13 13
 // Config holds the configurations for execs. The Daemon keeps
... ...
@@ -5,7 +5,7 @@ package daemon
5 5
 import (
6 6
 	"runtime"
7 7
 
8
-	"github.com/Sirupsen/logrus"
8
+	"github.com/sirupsen/logrus"
9 9
 )
10 10
 
11 11
 // getSize returns the real size & virtual size of the container.
... ...
@@ -35,7 +35,6 @@ import (
35 35
 	"sync"
36 36
 	"time"
37 37
 
38
-	"github.com/Sirupsen/logrus"
39 38
 	"github.com/docker/docker/daemon/graphdriver"
40 39
 	"github.com/docker/docker/pkg/archive"
41 40
 	"github.com/docker/docker/pkg/chrootarchive"
... ...
@@ -47,6 +46,7 @@ import (
47 47
 	rsystem "github.com/opencontainers/runc/libcontainer/system"
48 48
 	"github.com/opencontainers/selinux/go-selinux/label"
49 49
 	"github.com/pkg/errors"
50
+	"github.com/sirupsen/logrus"
50 51
 	"github.com/vbatts/tar-split/tar/storage"
51 52
 	"golang.org/x/sys/unix"
52 53
 )
... ...
@@ -5,7 +5,7 @@ package aufs
5 5
 import (
6 6
 	"os/exec"
7 7
 
8
-	"github.com/Sirupsen/logrus"
8
+	"github.com/sirupsen/logrus"
9 9
 	"golang.org/x/sys/unix"
10 10
 )
11 11
 
... ...
@@ -26,7 +26,6 @@ import (
26 26
 	"sync"
27 27
 	"unsafe"
28 28
 
29
-	"github.com/Sirupsen/logrus"
30 29
 	"github.com/docker/docker/daemon/graphdriver"
31 30
 	"github.com/docker/docker/pkg/idtools"
32 31
 	"github.com/docker/docker/pkg/mount"
... ...
@@ -34,6 +33,7 @@ import (
34 34
 	"github.com/docker/docker/pkg/system"
35 35
 	"github.com/docker/go-units"
36 36
 	"github.com/opencontainers/selinux/go-selinux/label"
37
+	"github.com/sirupsen/logrus"
37 38
 	"golang.org/x/sys/unix"
38 39
 )
39 40
 
... ...
@@ -12,8 +12,8 @@ import (
12 12
 	"reflect"
13 13
 	"strings"
14 14
 
15
-	"github.com/Sirupsen/logrus"
16 15
 	"github.com/pkg/errors"
16
+	"github.com/sirupsen/logrus"
17 17
 )
18 18
 
19 19
 type directLVMConfig struct {
... ...
@@ -18,7 +18,6 @@ import (
18 18
 	"sync"
19 19
 	"time"
20 20
 
21
-	"github.com/Sirupsen/logrus"
22 21
 	"github.com/docker/docker/daemon/graphdriver"
23 22
 	"github.com/docker/docker/dockerversion"
24 23
 	"github.com/docker/docker/pkg/devicemapper"
... ...
@@ -29,6 +28,7 @@ import (
29 29
 	units "github.com/docker/go-units"
30 30
 	"github.com/opencontainers/selinux/go-selinux/label"
31 31
 	"github.com/pkg/errors"
32
+	"github.com/sirupsen/logrus"
32 33
 	"golang.org/x/sys/unix"
33 34
 )
34 35
 
... ...
@@ -9,7 +9,7 @@ import (
9 9
 	"path"
10 10
 	"strconv"
11 11
 
12
-	"github.com/Sirupsen/logrus"
12
+	"github.com/sirupsen/logrus"
13 13
 
14 14
 	"github.com/docker/docker/daemon/graphdriver"
15 15
 	"github.com/docker/docker/pkg/devicemapper"
... ...
@@ -8,7 +8,7 @@ import (
8 8
 	"path/filepath"
9 9
 	"strings"
10 10
 
11
-	"github.com/Sirupsen/logrus"
11
+	"github.com/sirupsen/logrus"
12 12
 	"github.com/vbatts/tar-split/tar/storage"
13 13
 
14 14
 	"github.com/docker/docker/pkg/archive"
... ...
@@ -19,8 +19,8 @@ import (
19 19
 	"path/filepath"
20 20
 	"unsafe"
21 21
 
22
-	"github.com/Sirupsen/logrus"
23 22
 	"github.com/docker/docker/pkg/mount"
23
+	"github.com/sirupsen/logrus"
24 24
 )
25 25
 
26 26
 const (
... ...
@@ -4,11 +4,11 @@ import (
4 4
 	"io"
5 5
 	"time"
6 6
 
7
-	"github.com/Sirupsen/logrus"
8 7
 	"github.com/docker/docker/pkg/archive"
9 8
 	"github.com/docker/docker/pkg/chrootarchive"
10 9
 	"github.com/docker/docker/pkg/idtools"
11 10
 	"github.com/docker/docker/pkg/ioutils"
11
+	"github.com/sirupsen/logrus"
12 12
 )
13 13
 
14 14
 var (
... ...
@@ -32,13 +32,13 @@ import (
32 32
 	"time"
33 33
 
34 34
 	"github.com/Microsoft/hcsshim"
35
-	"github.com/Sirupsen/logrus"
36 35
 	"github.com/docker/docker/daemon/graphdriver"
37 36
 	"github.com/docker/docker/pkg/archive"
38 37
 	"github.com/docker/docker/pkg/idtools"
39 38
 	"github.com/docker/docker/pkg/ioutils"
40 39
 	"github.com/docker/docker/pkg/system"
41 40
 	"github.com/jhowardmsft/opengcs/gogcs/client"
41
+	"github.com/sirupsen/logrus"
42 42
 )
43 43
 
44 44
 // init registers this driver to the register. It gets initialised by the
... ...
@@ -12,7 +12,6 @@ import (
12 12
 	"path"
13 13
 	"strconv"
14 14
 
15
-	"github.com/Sirupsen/logrus"
16 15
 	"github.com/docker/docker/daemon/graphdriver"
17 16
 	"github.com/docker/docker/daemon/graphdriver/overlayutils"
18 17
 	"github.com/docker/docker/pkg/archive"
... ...
@@ -22,6 +21,7 @@ import (
22 22
 	"github.com/docker/docker/pkg/mount"
23 23
 	"github.com/docker/docker/pkg/system"
24 24
 	"github.com/opencontainers/selinux/go-selinux/label"
25
+	"github.com/sirupsen/logrus"
25 26
 	"golang.org/x/sys/unix"
26 27
 )
27 28
 
... ...
@@ -9,9 +9,9 @@ import (
9 9
 	"path"
10 10
 	"path/filepath"
11 11
 
12
-	"github.com/Sirupsen/logrus"
13 12
 	"github.com/docker/docker/pkg/system"
14 13
 	"github.com/pkg/errors"
14
+	"github.com/sirupsen/logrus"
15 15
 	"golang.org/x/sys/unix"
16 16
 )
17 17
 
... ...
@@ -16,7 +16,7 @@ import (
16 16
 	"strings"
17 17
 	"sync"
18 18
 
19
-	"github.com/Sirupsen/logrus"
19
+	"github.com/sirupsen/logrus"
20 20
 
21 21
 	"github.com/docker/docker/daemon/graphdriver"
22 22
 	"github.com/docker/docker/daemon/graphdriver/overlayutils"
... ...
@@ -11,7 +11,7 @@ import (
11 11
 	"syscall"
12 12
 	"time"
13 13
 
14
-	"github.com/Sirupsen/logrus"
14
+	"github.com/sirupsen/logrus"
15 15
 	"golang.org/x/sys/unix"
16 16
 )
17 17
 
... ...
@@ -56,7 +56,7 @@ import (
56 56
 	"path/filepath"
57 57
 	"unsafe"
58 58
 
59
-	"github.com/Sirupsen/logrus"
59
+	"github.com/sirupsen/logrus"
60 60
 	"golang.org/x/sys/unix"
61 61
 )
62 62
 
... ...
@@ -24,7 +24,6 @@ import (
24 24
 	"github.com/Microsoft/go-winio/archive/tar"
25 25
 	"github.com/Microsoft/go-winio/backuptar"
26 26
 	"github.com/Microsoft/hcsshim"
27
-	"github.com/Sirupsen/logrus"
28 27
 	"github.com/docker/docker/daemon/graphdriver"
29 28
 	"github.com/docker/docker/pkg/archive"
30 29
 	"github.com/docker/docker/pkg/idtools"
... ...
@@ -33,6 +32,7 @@ import (
33 33
 	"github.com/docker/docker/pkg/reexec"
34 34
 	"github.com/docker/docker/pkg/system"
35 35
 	units "github.com/docker/go-units"
36
+	"github.com/sirupsen/logrus"
36 37
 	"golang.org/x/sys/windows"
37 38
 )
38 39
 
... ...
@@ -12,13 +12,13 @@ import (
12 12
 	"sync"
13 13
 	"time"
14 14
 
15
-	"github.com/Sirupsen/logrus"
16 15
 	"github.com/docker/docker/daemon/graphdriver"
17 16
 	"github.com/docker/docker/pkg/idtools"
18 17
 	"github.com/docker/docker/pkg/mount"
19 18
 	"github.com/docker/docker/pkg/parsers"
20 19
 	zfs "github.com/mistifyio/go-zfs"
21 20
 	"github.com/opencontainers/selinux/go-selinux/label"
21
+	"github.com/sirupsen/logrus"
22 22
 	"golang.org/x/sys/unix"
23 23
 )
24 24
 
... ...
@@ -4,8 +4,8 @@ import (
4 4
 	"fmt"
5 5
 	"strings"
6 6
 
7
-	"github.com/Sirupsen/logrus"
8 7
 	"github.com/docker/docker/daemon/graphdriver"
8
+	"github.com/sirupsen/logrus"
9 9
 	"golang.org/x/sys/unix"
10 10
 )
11 11
 
... ...
@@ -3,8 +3,8 @@ package zfs
3 3
 import (
4 4
 	"fmt"
5 5
 
6
-	"github.com/Sirupsen/logrus"
7 6
 	"github.com/docker/docker/daemon/graphdriver"
7
+	"github.com/sirupsen/logrus"
8 8
 	"golang.org/x/sys/unix"
9 9
 )
10 10
 
... ...
@@ -20,8 +20,8 @@ import (
20 20
 	"strings"
21 21
 	"unsafe"
22 22
 
23
-	"github.com/Sirupsen/logrus"
24 23
 	"github.com/docker/docker/daemon/graphdriver"
24
+	"github.com/sirupsen/logrus"
25 25
 )
26 26
 
27 27
 func checkRootdirFs(rootdir string) error {
... ...
@@ -10,12 +10,12 @@ import (
10 10
 
11 11
 	"golang.org/x/net/context"
12 12
 
13
-	"github.com/Sirupsen/logrus"
14 13
 	"github.com/docker/docker/api/types"
15 14
 	containertypes "github.com/docker/docker/api/types/container"
16 15
 	"github.com/docker/docker/api/types/strslice"
17 16
 	"github.com/docker/docker/container"
18 17
 	"github.com/docker/docker/daemon/exec"
18
+	"github.com/sirupsen/logrus"
19 19
 )
20 20
 
21 21
 const (
... ...
@@ -7,7 +7,6 @@ import (
7 7
 	"strings"
8 8
 	"time"
9 9
 
10
-	"github.com/Sirupsen/logrus"
11 10
 	"github.com/docker/docker/api"
12 11
 	"github.com/docker/docker/api/types"
13 12
 	"github.com/docker/docker/cli/debug"
... ...
@@ -22,6 +21,7 @@ import (
22 22
 	"github.com/docker/docker/registry"
23 23
 	"github.com/docker/docker/volume/drivers"
24 24
 	"github.com/docker/go-connections/sockets"
25
+	"github.com/sirupsen/logrus"
25 26
 )
26 27
 
27 28
 // SystemInfo returns information about the host server the daemon is running on.
... ...
@@ -7,11 +7,11 @@ import (
7 7
 	"os/exec"
8 8
 	"strings"
9 9
 
10
-	"github.com/Sirupsen/logrus"
11 10
 	"github.com/docker/docker/api/types"
12 11
 	"github.com/docker/docker/dockerversion"
13 12
 	"github.com/docker/docker/pkg/sysinfo"
14 13
 	"github.com/pkg/errors"
14
+	"github.com/sirupsen/logrus"
15 15
 )
16 16
 
17 17
 // FillPlatformInfo fills the platform related info.
... ...
@@ -8,9 +8,9 @@ import (
8 8
 	"syscall"
9 9
 	"time"
10 10
 
11
-	"github.com/Sirupsen/logrus"
12 11
 	containerpkg "github.com/docker/docker/container"
13 12
 	"github.com/docker/docker/pkg/signal"
13
+	"github.com/sirupsen/logrus"
14 14
 )
15 15
 
16 16
 type errNoSuchProcess struct {
... ...
@@ -7,13 +7,13 @@ import (
7 7
 	"strconv"
8 8
 	"strings"
9 9
 
10
-	"github.com/Sirupsen/logrus"
11 10
 	"github.com/docker/docker/api/types"
12 11
 	"github.com/docker/docker/api/types/filters"
13 12
 	"github.com/docker/docker/container"
14 13
 	"github.com/docker/docker/image"
15 14
 	"github.com/docker/docker/volume"
16 15
 	"github.com/docker/go-connections/nat"
16
+	"github.com/sirupsen/logrus"
17 17
 )
18 18
 
19 19
 var acceptedVolumeFilterTags = map[string]bool{
... ...
@@ -7,10 +7,10 @@ import (
7 7
 	"sync"
8 8
 	"time"
9 9
 
10
-	"github.com/Sirupsen/logrus"
11 10
 	"github.com/docker/docker/api/types/plugins/logdriver"
12 11
 	"github.com/docker/docker/pkg/plugingetter"
13 12
 	"github.com/pkg/errors"
13
+	"github.com/sirupsen/logrus"
14 14
 )
15 15
 
16 16
 // pluginAdapter takes a plugin and implements the Logger interface for logger
... ...
@@ -13,7 +13,6 @@ import (
13 13
 	"sync"
14 14
 	"time"
15 15
 
16
-	"github.com/Sirupsen/logrus"
17 16
 	"github.com/aws/aws-sdk-go/aws"
18 17
 	"github.com/aws/aws-sdk-go/aws/awserr"
19 18
 	"github.com/aws/aws-sdk-go/aws/ec2metadata"
... ...
@@ -25,6 +24,7 @@ import (
25 25
 	"github.com/docker/docker/dockerversion"
26 26
 	"github.com/docker/docker/pkg/templates"
27 27
 	"github.com/pkg/errors"
28
+	"github.com/sirupsen/logrus"
28 29
 )
29 30
 
30 31
 const (
... ...
@@ -6,7 +6,7 @@ import (
6 6
 	"sync"
7 7
 	"time"
8 8
 
9
-	"github.com/Sirupsen/logrus"
9
+	"github.com/sirupsen/logrus"
10 10
 )
11 11
 
12 12
 const (
... ...
@@ -18,8 +18,8 @@ import (
18 18
 	"sync"
19 19
 	"unsafe"
20 20
 
21
-	"github.com/Sirupsen/logrus"
22 21
 	"github.com/docker/docker/daemon/logger"
22
+	"github.com/sirupsen/logrus"
23 23
 	"golang.org/x/sys/windows"
24 24
 )
25 25
 
... ...
@@ -11,13 +11,13 @@ import (
11 11
 	"strings"
12 12
 	"time"
13 13
 
14
-	"github.com/Sirupsen/logrus"
15 14
 	"github.com/docker/docker/daemon/logger"
16 15
 	"github.com/docker/docker/daemon/logger/loggerutils"
17 16
 	"github.com/docker/docker/pkg/urlutil"
18 17
 	"github.com/docker/go-units"
19 18
 	"github.com/fluent/fluent-logger-golang/fluent"
20 19
 	"github.com/pkg/errors"
20
+	"github.com/sirupsen/logrus"
21 21
 )
22 22
 
23 23
 type fluentd struct {
... ...
@@ -10,7 +10,7 @@ import (
10 10
 
11 11
 	"cloud.google.com/go/compute/metadata"
12 12
 	"cloud.google.com/go/logging"
13
-	"github.com/Sirupsen/logrus"
13
+	"github.com/sirupsen/logrus"
14 14
 	"golang.org/x/net/context"
15 15
 	mrpb "google.golang.org/genproto/googleapis/api/monitoredres"
16 16
 )
... ...
@@ -5,9 +5,9 @@ package gcplogs
5 5
 import (
6 6
 	"os"
7 7
 
8
-	"github.com/Sirupsen/logrus"
9 8
 	"github.com/docker/docker/dockerversion"
10 9
 	"github.com/docker/docker/pkg/homedir"
10
+	"github.com/sirupsen/logrus"
11 11
 )
12 12
 
13 13
 // ensureHomeIfIAmStatic ensure $HOME to be set if dockerversion.IAmStatic is "true".
... ...
@@ -14,10 +14,10 @@ import (
14 14
 	"time"
15 15
 
16 16
 	"github.com/Graylog2/go-gelf/gelf"
17
-	"github.com/Sirupsen/logrus"
18 17
 	"github.com/docker/docker/daemon/logger"
19 18
 	"github.com/docker/docker/daemon/logger/loggerutils"
20 19
 	"github.com/docker/docker/pkg/urlutil"
20
+	"github.com/sirupsen/logrus"
21 21
 )
22 22
 
23 23
 const name = "gelf"
... ...
@@ -9,10 +9,10 @@ import (
9 9
 	"sync"
10 10
 	"unicode"
11 11
 
12
-	"github.com/Sirupsen/logrus"
13 12
 	"github.com/coreos/go-systemd/journal"
14 13
 	"github.com/docker/docker/daemon/logger"
15 14
 	"github.com/docker/docker/daemon/logger/loggerutils"
15
+	"github.com/sirupsen/logrus"
16 16
 )
17 17
 
18 18
 const name = "journald"
... ...
@@ -155,10 +155,10 @@ import (
155 155
 	"time"
156 156
 	"unsafe"
157 157
 
158
-	"github.com/Sirupsen/logrus"
159 158
 	"github.com/coreos/go-systemd/journal"
160 159
 	"github.com/docker/docker/api/types/backend"
161 160
 	"github.com/docker/docker/daemon/logger"
161
+	"github.com/sirupsen/logrus"
162 162
 )
163 163
 
164 164
 func (s *journald) Close() error {
... ...
@@ -11,12 +11,12 @@ import (
11 11
 	"strconv"
12 12
 	"sync"
13 13
 
14
-	"github.com/Sirupsen/logrus"
15 14
 	"github.com/docker/docker/daemon/logger"
16 15
 	"github.com/docker/docker/daemon/logger/loggerutils"
17 16
 	"github.com/docker/docker/pkg/jsonlog"
18 17
 	"github.com/docker/go-units"
19 18
 	"github.com/pkg/errors"
19
+	"github.com/sirupsen/logrus"
20 20
 )
21 21
 
22 22
 // Name is the name of the file that the jsonlogger logs to.
... ...
@@ -11,7 +11,6 @@ import (
11 11
 	"github.com/fsnotify/fsnotify"
12 12
 	"golang.org/x/net/context"
13 13
 
14
-	"github.com/Sirupsen/logrus"
15 14
 	"github.com/docker/docker/api/types/backend"
16 15
 	"github.com/docker/docker/daemon/logger"
17 16
 	"github.com/docker/docker/daemon/logger/jsonfilelog/multireader"
... ...
@@ -19,6 +18,7 @@ import (
19 19
 	"github.com/docker/docker/pkg/jsonlog"
20 20
 	"github.com/docker/docker/pkg/tailfile"
21 21
 	"github.com/pkg/errors"
22
+	"github.com/sirupsen/logrus"
22 23
 )
23 24
 
24 25
 const maxJSONDecodeRetry = 20000
... ...
@@ -5,9 +5,9 @@ package logentries
5 5
 import (
6 6
 	"fmt"
7 7
 
8
-	"github.com/Sirupsen/logrus"
9 8
 	"github.com/bsphere/le_go"
10 9
 	"github.com/docker/docker/daemon/logger"
10
+	"github.com/sirupsen/logrus"
11 11
 )
12 12
 
13 13
 type logentries struct {
... ...
@@ -5,7 +5,7 @@ import (
5 5
 	"sync"
6 6
 	"sync/atomic"
7 7
 
8
-	"github.com/Sirupsen/logrus"
8
+	"github.com/sirupsen/logrus"
9 9
 )
10 10
 
11 11
 const (
... ...
@@ -18,10 +18,10 @@ import (
18 18
 	"sync"
19 19
 	"time"
20 20
 
21
-	"github.com/Sirupsen/logrus"
22 21
 	"github.com/docker/docker/daemon/logger"
23 22
 	"github.com/docker/docker/daemon/logger/loggerutils"
24 23
 	"github.com/docker/docker/pkg/urlutil"
24
+	"github.com/sirupsen/logrus"
25 25
 )
26 26
 
27 27
 const (
... ...
@@ -14,11 +14,11 @@ import (
14 14
 
15 15
 	syslog "github.com/RackSec/srslog"
16 16
 
17
-	"github.com/Sirupsen/logrus"
18 17
 	"github.com/docker/docker/daemon/logger"
19 18
 	"github.com/docker/docker/daemon/logger/loggerutils"
20 19
 	"github.com/docker/docker/pkg/urlutil"
21 20
 	"github.com/docker/go-connections/tlsconfig"
21
+	"github.com/sirupsen/logrus"
22 22
 )
23 23
 
24 24
 const (
... ...
@@ -7,13 +7,13 @@ import (
7 7
 
8 8
 	"golang.org/x/net/context"
9 9
 
10
-	"github.com/Sirupsen/logrus"
11 10
 	"github.com/docker/docker/api/types"
12 11
 	"github.com/docker/docker/api/types/backend"
13 12
 	containertypes "github.com/docker/docker/api/types/container"
14 13
 	timetypes "github.com/docker/docker/api/types/time"
15 14
 	"github.com/docker/docker/container"
16 15
 	"github.com/docker/docker/daemon/logger"
16
+	"github.com/sirupsen/logrus"
17 17
 )
18 18
 
19 19
 // ContainerLogs copies the container's log channel to the channel provided in
... ...
@@ -4,12 +4,12 @@ import (
4 4
 	"path/filepath"
5 5
 	"sync"
6 6
 
7
-	"github.com/Sirupsen/logrus"
8 7
 	"github.com/docker/docker/pkg/mount"
9 8
 	"github.com/docker/docker/pkg/plugingetter"
10 9
 	"github.com/docker/go-metrics"
11 10
 	"github.com/pkg/errors"
12 11
 	"github.com/prometheus/client_golang/prometheus"
12
+	"github.com/sirupsen/logrus"
13 13
 )
14 14
 
15 15
 const metricsPluginType = "MetricsCollector"
... ...
@@ -8,12 +8,12 @@ import (
8 8
 	"os"
9 9
 	"path/filepath"
10 10
 
11
-	"github.com/Sirupsen/logrus"
12 11
 	"github.com/docker/docker/pkg/mount"
13 12
 	"github.com/docker/docker/pkg/plugingetter"
14 13
 	"github.com/docker/docker/pkg/plugins"
15 14
 	metrics "github.com/docker/go-metrics"
16 15
 	"github.com/pkg/errors"
16
+	"github.com/sirupsen/logrus"
17 17
 	"golang.org/x/sys/unix"
18 18
 )
19 19
 
... ...
@@ -7,11 +7,11 @@ import (
7 7
 	"strconv"
8 8
 	"time"
9 9
 
10
-	"github.com/Sirupsen/logrus"
11 10
 	"github.com/docker/docker/api/types"
12 11
 	"github.com/docker/docker/container"
13 12
 	"github.com/docker/docker/libcontainerd"
14 13
 	"github.com/docker/docker/restartmanager"
14
+	"github.com/sirupsen/logrus"
15 15
 )
16 16
 
17 17
 func (daemon *Daemon) setStateCounter(c *container.Container) {
... ...
@@ -4,11 +4,11 @@ import (
4 4
 	"fmt"
5 5
 	"strings"
6 6
 
7
-	"github.com/Sirupsen/logrus"
8 7
 	"github.com/docker/docker/api"
9 8
 	"github.com/docker/docker/container"
10 9
 	"github.com/docker/docker/pkg/namesgenerator"
11 10
 	"github.com/docker/docker/pkg/stringid"
11
+	"github.com/sirupsen/logrus"
12 12
 )
13 13
 
14 14
 var (
... ...
@@ -8,7 +8,6 @@ import (
8 8
 	"strings"
9 9
 	"sync"
10 10
 
11
-	"github.com/Sirupsen/logrus"
12 11
 	apierrors "github.com/docker/docker/api/errors"
13 12
 	"github.com/docker/docker/api/types"
14 13
 	"github.com/docker/docker/api/types/network"
... ...
@@ -21,6 +20,7 @@ import (
21 21
 	"github.com/docker/libnetwork/ipamapi"
22 22
 	networktypes "github.com/docker/libnetwork/types"
23 23
 	"github.com/pkg/errors"
24
+	"github.com/sirupsen/logrus"
24 25
 	"golang.org/x/net/context"
25 26
 )
26 27
 
... ...
@@ -11,7 +11,6 @@ import (
11 11
 	"strconv"
12 12
 	"strings"
13 13
 
14
-	"github.com/Sirupsen/logrus"
15 14
 	containertypes "github.com/docker/docker/api/types/container"
16 15
 	"github.com/docker/docker/container"
17 16
 	"github.com/docker/docker/daemon/caps"
... ...
@@ -27,6 +26,7 @@ import (
27 27
 	"github.com/opencontainers/runc/libcontainer/devices"
28 28
 	"github.com/opencontainers/runc/libcontainer/user"
29 29
 	specs "github.com/opencontainers/runtime-spec/specs-go"
30
+	"github.com/sirupsen/logrus"
30 31
 )
31 32
 
32 33
 var (
... ...
@@ -7,7 +7,6 @@ import (
7 7
 	"sync/atomic"
8 8
 	"time"
9 9
 
10
-	"github.com/Sirupsen/logrus"
11 10
 	"github.com/docker/distribution/reference"
12 11
 	"github.com/docker/docker/api/types"
13 12
 	"github.com/docker/docker/api/types/filters"
... ...
@@ -20,6 +19,7 @@ import (
20 20
 	"github.com/docker/docker/volume"
21 21
 	"github.com/docker/libnetwork"
22 22
 	digest "github.com/opencontainers/go-digest"
23
+	"github.com/sirupsen/logrus"
23 24
 	"golang.org/x/net/context"
24 25
 )
25 26
 
... ...
@@ -4,10 +4,10 @@ import (
4 4
 	"encoding/json"
5 5
 	"fmt"
6 6
 
7
-	"github.com/Sirupsen/logrus"
8 7
 	"github.com/docker/docker/daemon/config"
9 8
 	"github.com/docker/docker/daemon/discovery"
10 9
 	"github.com/docker/docker/libcontainerd"
10
+	"github.com/sirupsen/logrus"
11 11
 )
12 12
 
13 13
 // Reload reads configuration changes and modifies the
... ...
@@ -5,9 +5,9 @@ import (
5 5
 	"fmt"
6 6
 	"strings"
7 7
 
8
-	"github.com/Sirupsen/logrus"
9 8
 	dockercontainer "github.com/docker/docker/container"
10 9
 	"github.com/docker/libnetwork"
10
+	"github.com/sirupsen/logrus"
11 11
 )
12 12
 
13 13
 // ContainerRename changes the name of a container, using the oldName
... ...
@@ -3,8 +3,8 @@ package daemon
3 3
 import (
4 4
 	"fmt"
5 5
 
6
-	"github.com/Sirupsen/logrus"
7 6
 	"github.com/docker/docker/container"
7
+	"github.com/sirupsen/logrus"
8 8
 )
9 9
 
10 10
 // ContainerRestart stops and starts a container. It attempts to
... ...
@@ -5,10 +5,10 @@ package daemon
5 5
 import (
6 6
 	"fmt"
7 7
 
8
-	"github.com/Sirupsen/logrus"
9 8
 	"github.com/docker/docker/container"
10 9
 	"github.com/docker/docker/profiles/seccomp"
11 10
 	"github.com/opencontainers/runtime-spec/specs-go"
11
+	"github.com/sirupsen/logrus"
12 12
 )
13 13
 
14 14
 var supportsSeccomp = true
... ...
@@ -1,8 +1,8 @@
1 1
 package daemon
2 2
 
3 3
 import (
4
-	"github.com/Sirupsen/logrus"
5 4
 	swarmtypes "github.com/docker/docker/api/types/swarm"
5
+	"github.com/sirupsen/logrus"
6 6
 )
7 7
 
8 8
 // SetContainerSecretReferences sets the container secret references needed
... ...
@@ -10,11 +10,11 @@ import (
10 10
 
11 11
 	"google.golang.org/grpc"
12 12
 
13
-	"github.com/Sirupsen/logrus"
14 13
 	apierrors "github.com/docker/docker/api/errors"
15 14
 	"github.com/docker/docker/api/types"
16 15
 	containertypes "github.com/docker/docker/api/types/container"
17 16
 	"github.com/docker/docker/container"
17
+	"github.com/sirupsen/logrus"
18 18
 )
19 19
 
20 20
 // ContainerStart starts a container.
... ...
@@ -5,10 +5,10 @@ package stats
5 5
 import (
6 6
 	"time"
7 7
 
8
-	"github.com/Sirupsen/logrus"
9 8
 	"github.com/docker/docker/api/types"
10 9
 	"github.com/docker/docker/container"
11 10
 	"github.com/docker/docker/pkg/pubsub"
11
+	"github.com/sirupsen/logrus"
12 12
 )
13 13
 
14 14
 // Collect registers the container with the collector and adds it to
... ...
@@ -6,9 +6,9 @@ import (
6 6
 	"net/http"
7 7
 	"time"
8 8
 
9
-	"github.com/Sirupsen/logrus"
10 9
 	"github.com/docker/docker/api/errors"
11 10
 	containerpkg "github.com/docker/docker/container"
11
+	"github.com/sirupsen/logrus"
12 12
 )
13 13
 
14 14
 // ContainerStop looks for the given container and terminates it,
... ...
@@ -9,7 +9,6 @@ import (
9 9
 	"strings"
10 10
 	"time"
11 11
 
12
-	"github.com/Sirupsen/logrus"
13 12
 	dockererrors "github.com/docker/docker/api/errors"
14 13
 	"github.com/docker/docker/api/types"
15 14
 	containertypes "github.com/docker/docker/api/types/container"
... ...
@@ -17,6 +16,7 @@ import (
17 17
 	"github.com/docker/docker/container"
18 18
 	"github.com/docker/docker/volume"
19 19
 	"github.com/docker/docker/volume/drivers"
20
+	"github.com/sirupsen/logrus"
20 21
 )
21 22
 
22 23
 var (
... ...
@@ -5,7 +5,6 @@ import (
5 5
 	"strings"
6 6
 	"syscall"
7 7
 
8
-	"github.com/Sirupsen/logrus"
9 8
 	"github.com/docker/distribution"
10 9
 	"github.com/docker/distribution/reference"
11 10
 	"github.com/docker/distribution/registry/api/errcode"
... ...
@@ -14,6 +13,7 @@ import (
14 14
 	"github.com/docker/distribution/registry/client/auth"
15 15
 	"github.com/docker/docker/distribution/xfer"
16 16
 	"github.com/pkg/errors"
17
+	"github.com/sirupsen/logrus"
17 18
 )
18 19
 
19 20
 // ErrNoSupport is an error type used for errors indicating that an operation
... ...
@@ -3,7 +3,6 @@ package distribution
3 3
 import (
4 4
 	"fmt"
5 5
 
6
-	"github.com/Sirupsen/logrus"
7 6
 	"github.com/docker/distribution/reference"
8 7
 	"github.com/docker/docker/api"
9 8
 	"github.com/docker/docker/distribution/metadata"
... ...
@@ -11,6 +10,7 @@ import (
11 11
 	refstore "github.com/docker/docker/reference"
12 12
 	"github.com/docker/docker/registry"
13 13
 	"github.com/opencontainers/go-digest"
14
+	"github.com/sirupsen/logrus"
14 15
 	"golang.org/x/net/context"
15 16
 )
16 17
 
... ...
@@ -11,7 +11,6 @@ import (
11 11
 	"strings"
12 12
 	"time"
13 13
 
14
-	"github.com/Sirupsen/logrus"
15 14
 	"github.com/docker/distribution/reference"
16 15
 	"github.com/docker/distribution/registry/client/transport"
17 16
 	"github.com/docker/docker/distribution/metadata"
... ...
@@ -24,6 +23,7 @@ import (
24 24
 	"github.com/docker/docker/pkg/progress"
25 25
 	"github.com/docker/docker/pkg/stringid"
26 26
 	"github.com/docker/docker/registry"
27
+	"github.com/sirupsen/logrus"
27 28
 	"golang.org/x/net/context"
28 29
 )
29 30
 
... ...
@@ -10,7 +10,6 @@ import (
10 10
 	"os"
11 11
 	"runtime"
12 12
 
13
-	"github.com/Sirupsen/logrus"
14 13
 	"github.com/docker/distribution"
15 14
 	"github.com/docker/distribution/manifest/manifestlist"
16 15
 	"github.com/docker/distribution/manifest/schema1"
... ...
@@ -31,6 +30,7 @@ import (
31 31
 	refstore "github.com/docker/docker/reference"
32 32
 	"github.com/docker/docker/registry"
33 33
 	"github.com/opencontainers/go-digest"
34
+	"github.com/sirupsen/logrus"
34 35
 	"golang.org/x/net/context"
35 36
 )
36 37
 
... ...
@@ -6,11 +6,11 @@ import (
6 6
 	"net/http"
7 7
 	"os"
8 8
 
9
-	"github.com/Sirupsen/logrus"
10 9
 	"github.com/docker/distribution"
11 10
 	"github.com/docker/distribution/context"
12 11
 	"github.com/docker/distribution/manifest/schema2"
13 12
 	"github.com/docker/distribution/registry/client/transport"
13
+	"github.com/sirupsen/logrus"
14 14
 )
15 15
 
16 16
 var _ distribution.Describable = &v2LayerDescriptor{}
... ...
@@ -6,11 +6,11 @@ import (
6 6
 	"fmt"
7 7
 	"io"
8 8
 
9
-	"github.com/Sirupsen/logrus"
10 9
 	"github.com/docker/distribution/reference"
11 10
 	"github.com/docker/docker/distribution/metadata"
12 11
 	"github.com/docker/docker/pkg/progress"
13 12
 	"github.com/docker/docker/registry"
13
+	"github.com/sirupsen/logrus"
14 14
 	"golang.org/x/net/context"
15 15
 )
16 16
 
... ...
@@ -4,7 +4,6 @@ import (
4 4
 	"fmt"
5 5
 	"sync"
6 6
 
7
-	"github.com/Sirupsen/logrus"
8 7
 	"github.com/docker/distribution/reference"
9 8
 	"github.com/docker/distribution/registry/client/transport"
10 9
 	"github.com/docker/docker/distribution/metadata"
... ...
@@ -17,6 +16,7 @@ import (
17 17
 	"github.com/docker/docker/pkg/stringid"
18 18
 	"github.com/docker/docker/registry"
19 19
 	"github.com/opencontainers/go-digest"
20
+	"github.com/sirupsen/logrus"
20 21
 	"golang.org/x/net/context"
21 22
 )
22 23
 
... ...
@@ -11,7 +11,6 @@ import (
11 11
 
12 12
 	"golang.org/x/net/context"
13 13
 
14
-	"github.com/Sirupsen/logrus"
15 14
 	"github.com/docker/distribution"
16 15
 	"github.com/docker/distribution/manifest/schema1"
17 16
 	"github.com/docker/distribution/manifest/schema2"
... ...
@@ -26,6 +25,7 @@ import (
26 26
 	"github.com/docker/docker/pkg/stringid"
27 27
 	"github.com/docker/docker/registry"
28 28
 	"github.com/opencontainers/go-digest"
29
+	"github.com/sirupsen/logrus"
29 30
 )
30 31
 
31 32
 const (
... ...
@@ -11,13 +11,13 @@ import (
11 11
 	"strings"
12 12
 	"testing"
13 13
 
14
-	"github.com/Sirupsen/logrus"
15 14
 	"github.com/docker/distribution/reference"
16 15
 	"github.com/docker/docker/api/types"
17 16
 	registrytypes "github.com/docker/docker/api/types/registry"
18 17
 	"github.com/docker/docker/pkg/archive"
19 18
 	"github.com/docker/docker/pkg/stringid"
20 19
 	"github.com/docker/docker/registry"
20
+	"github.com/sirupsen/logrus"
21 21
 	"golang.org/x/net/context"
22 22
 )
23 23
 
... ...
@@ -6,9 +6,9 @@ import (
6 6
 	"os"
7 7
 	"syscall"
8 8
 
9
-	"github.com/Sirupsen/logrus"
10 9
 	"github.com/docker/docker/pkg/progress"
11 10
 	"github.com/docker/docker/pkg/streamformatter"
11
+	"github.com/sirupsen/logrus"
12 12
 )
13 13
 
14 14
 // WriteDistributionProgress is a helper for writing progress from chan to JSON
... ...
@@ -7,13 +7,13 @@ import (
7 7
 	"runtime"
8 8
 	"time"
9 9
 
10
-	"github.com/Sirupsen/logrus"
11 10
 	"github.com/docker/distribution"
12 11
 	"github.com/docker/docker/image"
13 12
 	"github.com/docker/docker/layer"
14 13
 	"github.com/docker/docker/pkg/archive"
15 14
 	"github.com/docker/docker/pkg/ioutils"
16 15
 	"github.com/docker/docker/pkg/progress"
16
+	"github.com/sirupsen/logrus"
17 17
 	"golang.org/x/net/context"
18 18
 )
19 19
 
... ...
@@ -4,10 +4,10 @@ import (
4 4
 	"errors"
5 5
 	"time"
6 6
 
7
-	"github.com/Sirupsen/logrus"
8 7
 	"github.com/docker/distribution"
9 8
 	"github.com/docker/docker/layer"
10 9
 	"github.com/docker/docker/pkg/progress"
10
+	"github.com/sirupsen/logrus"
11 11
 	"golang.org/x/net/context"
12 12
 )
13 13
 
... ...
@@ -10,11 +10,11 @@ import (
10 10
 	"strings"
11 11
 	"time"
12 12
 
13
-	"github.com/Sirupsen/logrus"
14 13
 	"github.com/docker/docker/api/types"
15 14
 	"github.com/docker/docker/api/types/filters"
16 15
 	"github.com/docker/docker/client"
17 16
 	"github.com/docker/docker/pkg/stdcopy"
17
+	"github.com/sirupsen/logrus"
18 18
 )
19 19
 
20 20
 const (
... ...
@@ -7,10 +7,10 @@ import (
7 7
 	"path/filepath"
8 8
 	"sync"
9 9
 
10
-	"github.com/Sirupsen/logrus"
11 10
 	"github.com/docker/docker/pkg/ioutils"
12 11
 	"github.com/opencontainers/go-digest"
13 12
 	"github.com/pkg/errors"
13
+	"github.com/sirupsen/logrus"
14 14
 )
15 15
 
16 16
 // DigestWalkFunc is function called by StoreBackend.Walk
... ...
@@ -3,8 +3,8 @@ package image
3 3
 import (
4 4
 	"runtime"
5 5
 
6
-	"github.com/Sirupsen/logrus"
7 6
 	"github.com/docker/docker/layer"
7
+	"github.com/sirupsen/logrus"
8 8
 )
9 9
 
10 10
 // TypeLayers is used for RootFS.Type for filesystems organized into layers.
... ...
@@ -7,12 +7,12 @@ import (
7 7
 	"sync"
8 8
 	"time"
9 9
 
10
-	"github.com/Sirupsen/logrus"
11 10
 	"github.com/docker/distribution/digestset"
12 11
 	"github.com/docker/docker/layer"
13 12
 	"github.com/docker/docker/pkg/system"
14 13
 	"github.com/opencontainers/go-digest"
15 14
 	"github.com/pkg/errors"
15
+	"github.com/sirupsen/logrus"
16 16
 )
17 17
 
18 18
 // Store is an interface for creating and accessing images
... ...
@@ -11,7 +11,6 @@ import (
11 11
 	"reflect"
12 12
 	"runtime"
13 13
 
14
-	"github.com/Sirupsen/logrus"
15 14
 	"github.com/docker/distribution"
16 15
 	"github.com/docker/distribution/reference"
17 16
 	"github.com/docker/docker/image"
... ...
@@ -25,6 +24,7 @@ import (
25 25
 	"github.com/docker/docker/pkg/symlink"
26 26
 	"github.com/docker/docker/pkg/system"
27 27
 	"github.com/opencontainers/go-digest"
28
+	"github.com/sirupsen/logrus"
28 29
 )
29 30
 
30 31
 func (l *tarexporter) Load(inTar io.ReadCloser, outStream io.Writer, quiet bool) error {
... ...
@@ -5,12 +5,12 @@ import (
5 5
 	"reflect"
6 6
 	"strings"
7 7
 
8
-	"github.com/Sirupsen/logrus"
9 8
 	"github.com/docker/docker/api/types/versions"
10 9
 	"github.com/docker/docker/image"
11 10
 	"github.com/docker/docker/layer"
12 11
 	"github.com/docker/docker/pkg/stringid"
13 12
 	"github.com/opencontainers/go-digest"
13
+	"github.com/sirupsen/logrus"
14 14
 )
15 15
 
16 16
 // noFallbackMinVersion is the minimum version for which v1compatibility
... ...
@@ -9,10 +9,10 @@ import (
9 9
 	"strconv"
10 10
 	"strings"
11 11
 
12
-	"github.com/Sirupsen/logrus"
13 12
 	eventstestutils "github.com/docker/docker/daemon/events/testutils"
14 13
 	"github.com/docker/docker/integration-cli/checker"
15 14
 	"github.com/go-check/check"
15
+	"github.com/sirupsen/logrus"
16 16
 )
17 17
 
18 18
 // eventMatcher is a function that tries to match an event input.
... ...
@@ -13,10 +13,10 @@ import (
13 13
 	"strconv"
14 14
 	"strings"
15 15
 
16
-	"github.com/Sirupsen/logrus"
17 16
 	"github.com/docker/distribution"
18 17
 	"github.com/docker/docker/pkg/ioutils"
19 18
 	"github.com/opencontainers/go-digest"
19
+	"github.com/sirupsen/logrus"
20 20
 )
21 21
 
22 22
 var (
... ...
@@ -13,10 +13,10 @@ import (
13 13
 	"errors"
14 14
 	"io"
15 15
 
16
-	"github.com/Sirupsen/logrus"
17 16
 	"github.com/docker/distribution"
18 17
 	"github.com/docker/docker/pkg/archive"
19 18
 	"github.com/opencontainers/go-digest"
19
+	"github.com/sirupsen/logrus"
20 20
 )
21 21
 
22 22
 var (
... ...
@@ -8,7 +8,6 @@ import (
8 8
 	"strings"
9 9
 	"sync"
10 10
 
11
-	"github.com/Sirupsen/logrus"
12 11
 	"github.com/docker/distribution"
13 12
 	"github.com/docker/docker/daemon/graphdriver"
14 13
 	"github.com/docker/docker/pkg/idtools"
... ...
@@ -16,6 +15,7 @@ import (
16 16
 	"github.com/docker/docker/pkg/stringid"
17 17
 	"github.com/docker/docker/pkg/system"
18 18
 	"github.com/opencontainers/go-digest"
19
+	"github.com/sirupsen/logrus"
19 20
 	"github.com/vbatts/tar-split/tar/asm"
20 21
 	"github.com/vbatts/tar-split/tar/storage"
21 22
 )
... ...
@@ -7,8 +7,8 @@ import (
7 7
 	"io"
8 8
 	"os"
9 9
 
10
-	"github.com/Sirupsen/logrus"
11 10
 	"github.com/opencontainers/go-digest"
11
+	"github.com/sirupsen/logrus"
12 12
 	"github.com/vbatts/tar-split/tar/asm"
13 13
 	"github.com/vbatts/tar-split/tar/storage"
14 14
 )
... ...
@@ -7,7 +7,6 @@ import (
7 7
 	"sync"
8 8
 	"time"
9 9
 
10
-	"github.com/Sirupsen/logrus"
11 10
 	containerd "github.com/containerd/containerd/api/grpc/types"
12 11
 	containerd_runtime_types "github.com/containerd/containerd/runtime"
13 12
 	"github.com/docker/docker/pkg/ioutils"
... ...
@@ -15,6 +14,7 @@ import (
15 15
 	"github.com/golang/protobuf/ptypes"
16 16
 	"github.com/golang/protobuf/ptypes/timestamp"
17 17
 	specs "github.com/opencontainers/runtime-spec/specs-go"
18
+	"github.com/sirupsen/logrus"
18 19
 	"golang.org/x/net/context"
19 20
 	"golang.org/x/sys/unix"
20 21
 )
... ...
@@ -10,10 +10,10 @@ import (
10 10
 	"strings"
11 11
 	"sync"
12 12
 
13
-	"github.com/Sirupsen/logrus"
14 13
 	containerd "github.com/containerd/containerd/api/grpc/types"
15 14
 	"github.com/docker/docker/pkg/idtools"
16 15
 	specs "github.com/opencontainers/runtime-spec/specs-go"
16
+	"github.com/sirupsen/logrus"
17 17
 	"golang.org/x/net/context"
18 18
 )
19 19
 
... ...
@@ -15,9 +15,9 @@ import (
15 15
 	"golang.org/x/net/context"
16 16
 
17 17
 	"github.com/Microsoft/hcsshim"
18
-	"github.com/Sirupsen/logrus"
19 18
 	"github.com/docker/docker/pkg/sysinfo"
20 19
 	specs "github.com/opencontainers/runtime-spec/specs-go"
20
+	"github.com/sirupsen/logrus"
21 21
 )
22 22
 
23 23
 type client struct {
... ...
@@ -11,10 +11,10 @@ import (
11 11
 	"sync"
12 12
 	"time"
13 13
 
14
-	"github.com/Sirupsen/logrus"
15 14
 	containerd "github.com/containerd/containerd/api/grpc/types"
16 15
 	"github.com/docker/docker/pkg/ioutils"
17 16
 	specs "github.com/opencontainers/runtime-spec/specs-go"
17
+	"github.com/sirupsen/logrus"
18 18
 	"github.com/tonistiigi/fifo"
19 19
 	"golang.org/x/net/context"
20 20
 	"golang.org/x/sys/unix"
... ...
@@ -9,9 +9,9 @@ import (
9 9
 	"time"
10 10
 
11 11
 	"github.com/Microsoft/hcsshim"
12
-	"github.com/Sirupsen/logrus"
13 12
 	"github.com/docker/docker/pkg/system"
14 13
 	"github.com/opencontainers/runtime-spec/specs-go"
14
+	"github.com/sirupsen/logrus"
15 15
 	"golang.org/x/sys/windows"
16 16
 )
17 17
 
... ...
@@ -5,8 +5,8 @@ import (
5 5
 	"os"
6 6
 	"strconv"
7 7
 
8
-	"github.com/Sirupsen/logrus"
9 8
 	"github.com/opencontainers/runc/libcontainer/system"
9
+	"github.com/sirupsen/logrus"
10 10
 )
11 11
 
12 12
 func setOOMScore(pid, score int) error {
... ...
@@ -17,12 +17,12 @@ import (
17 17
 	"sync"
18 18
 	"time"
19 19
 
20
-	"github.com/Sirupsen/logrus"
21 20
 	containerd "github.com/containerd/containerd/api/grpc/types"
22 21
 	"github.com/docker/docker/pkg/locker"
23 22
 	"github.com/docker/docker/pkg/system"
24 23
 	"github.com/golang/protobuf/ptypes"
25 24
 	"github.com/golang/protobuf/ptypes/timestamp"
25
+	"github.com/sirupsen/logrus"
26 26
 	"golang.org/x/net/context"
27 27
 	"golang.org/x/sys/unix"
28 28
 	"google.golang.org/grpc"
... ...
@@ -13,7 +13,6 @@ import (
13 13
 
14 14
 	"encoding/json"
15 15
 
16
-	"github.com/Sirupsen/logrus"
17 16
 	"github.com/docker/distribution/reference"
18 17
 	"github.com/docker/docker/distribution/metadata"
19 18
 	"github.com/docker/docker/image"
... ...
@@ -22,6 +21,7 @@ import (
22 22
 	"github.com/docker/docker/pkg/ioutils"
23 23
 	refstore "github.com/docker/docker/reference"
24 24
 	"github.com/opencontainers/go-digest"
25
+	"github.com/sirupsen/logrus"
25 26
 )
26 27
 
27 28
 type graphIDRegistrar interface {
... ...
@@ -16,13 +16,13 @@ import (
16 16
 	"strings"
17 17
 	"syscall"
18 18
 
19
-	"github.com/Sirupsen/logrus"
20 19
 	"github.com/docker/docker/pkg/fileutils"
21 20
 	"github.com/docker/docker/pkg/idtools"
22 21
 	"github.com/docker/docker/pkg/ioutils"
23 22
 	"github.com/docker/docker/pkg/pools"
24 23
 	"github.com/docker/docker/pkg/promise"
25 24
 	"github.com/docker/docker/pkg/system"
25
+	"github.com/sirupsen/logrus"
26 26
 )
27 27
 
28 28
 type (
... ...
@@ -13,10 +13,10 @@ import (
13 13
 	"syscall"
14 14
 	"time"
15 15
 
16
-	"github.com/Sirupsen/logrus"
17 16
 	"github.com/docker/docker/pkg/idtools"
18 17
 	"github.com/docker/docker/pkg/pools"
19 18
 	"github.com/docker/docker/pkg/system"
19
+	"github.com/sirupsen/logrus"
20 20
 )
21 21
 
22 22
 // ChangeType represents the change type.
... ...
@@ -9,8 +9,8 @@ import (
9 9
 	"path/filepath"
10 10
 	"strings"
11 11
 
12
-	"github.com/Sirupsen/logrus"
13 12
 	"github.com/docker/docker/pkg/system"
13
+	"github.com/sirupsen/logrus"
14 14
 )
15 15
 
16 16
 // Errors used or returned by this file.
... ...
@@ -10,10 +10,10 @@ import (
10 10
 	"runtime"
11 11
 	"strings"
12 12
 
13
-	"github.com/Sirupsen/logrus"
14 13
 	"github.com/docker/docker/pkg/idtools"
15 14
 	"github.com/docker/docker/pkg/pools"
16 15
 	"github.com/docker/docker/pkg/system"
16
+	"github.com/sirupsen/logrus"
17 17
 )
18 18
 
19 19
 // UnpackLayer unpack `layer` to a `dest`. The stream `layer` can be
... ...
@@ -13,8 +13,8 @@ import (
13 13
 	"os"
14 14
 	"path"
15 15
 
16
-	"github.com/Sirupsen/logrus"
17 16
 	"github.com/docker/docker/pkg/archive"
17
+	"github.com/sirupsen/logrus"
18 18
 )
19 19
 
20 20
 var (
... ...
@@ -8,8 +8,8 @@ import (
8 8
 	"net/http"
9 9
 	"strings"
10 10
 
11
-	"github.com/Sirupsen/logrus"
12 11
 	"github.com/docker/docker/pkg/ioutils"
12
+	"github.com/sirupsen/logrus"
13 13
 )
14 14
 
15 15
 const maxBodySize = 1048576 // 1MB
... ...
@@ -4,8 +4,8 @@ import (
4 4
 	"net/http"
5 5
 	"sync"
6 6
 
7
-	"github.com/Sirupsen/logrus"
8 7
 	"github.com/docker/docker/pkg/plugingetter"
8
+	"github.com/sirupsen/logrus"
9 9
 	"golang.org/x/net/context"
10 10
 )
11 11
 
... ...
@@ -8,7 +8,7 @@ import (
8 8
 	"net"
9 9
 	"net/http"
10 10
 
11
-	"github.com/Sirupsen/logrus"
11
+	"github.com/sirupsen/logrus"
12 12
 )
13 13
 
14 14
 // ResponseModifier allows authorization plugins to read and modify the content of the http.response
... ...
@@ -9,7 +9,7 @@ import (
9 9
 	"runtime"
10 10
 	"unsafe"
11 11
 
12
-	"github.com/Sirupsen/logrus"
12
+	"github.com/sirupsen/logrus"
13 13
 	"golang.org/x/sys/unix"
14 14
 )
15 15
 
... ...
@@ -8,7 +8,7 @@ import (
8 8
 	"fmt"
9 9
 	"strings"
10 10
 
11
-	"github.com/Sirupsen/logrus"
11
+	"github.com/sirupsen/logrus"
12 12
 )
13 13
 
14 14
 // DevmapperLogger defines methods required to register as a callback for
... ...
@@ -6,7 +6,7 @@ import (
6 6
 	"strings"
7 7
 	"time"
8 8
 
9
-	"github.com/Sirupsen/logrus"
9
+	"github.com/sirupsen/logrus"
10 10
 )
11 11
 
12 12
 var (
... ...
@@ -6,7 +6,6 @@ import (
6 6
 	"strings"
7 7
 	"time"
8 8
 
9
-	"github.com/Sirupsen/logrus"
10 9
 	"github.com/docker/docker/pkg/discovery"
11 10
 	"github.com/docker/go-connections/tlsconfig"
12 11
 	"github.com/docker/libkv"
... ...
@@ -14,6 +13,7 @@ import (
14 14
 	"github.com/docker/libkv/store/consul"
15 15
 	"github.com/docker/libkv/store/etcd"
16 16
 	"github.com/docker/libkv/store/zookeeper"
17
+	"github.com/sirupsen/logrus"
17 18
 )
18 19
 
19 20
 const (
... ...
@@ -7,7 +7,7 @@ import (
7 7
 	"sync"
8 8
 	"time"
9 9
 
10
-	"github.com/Sirupsen/logrus"
10
+	"github.com/sirupsen/logrus"
11 11
 
12 12
 	"github.com/fsnotify/fsnotify"
13 13
 )
... ...
@@ -10,7 +10,7 @@ import (
10 10
 	"strings"
11 11
 	"text/scanner"
12 12
 
13
-	"github.com/Sirupsen/logrus"
13
+	"github.com/sirupsen/logrus"
14 14
 )
15 15
 
16 16
 // PatternMatcher allows checking paths agaist a list of patterns
... ...
@@ -7,7 +7,7 @@ import (
7 7
 	"io/ioutil"
8 8
 	"os"
9 9
 
10
-	"github.com/Sirupsen/logrus"
10
+	"github.com/sirupsen/logrus"
11 11
 )
12 12
 
13 13
 // GetTotalUsedFds Returns the number of used File Descriptors by
... ...
@@ -6,8 +6,8 @@ import (
6 6
 	"net"
7 7
 	"os"
8 8
 
9
-	"github.com/Sirupsen/logrus"
10 9
 	"github.com/docker/go-connections/sockets"
10
+	"github.com/sirupsen/logrus"
11 11
 )
12 12
 
13 13
 // Init creates new listeners for the server.
... ...
@@ -9,9 +9,9 @@ import (
9 9
 	"os"
10 10
 	"strconv"
11 11
 
12
-	"github.com/Sirupsen/logrus"
13 12
 	"github.com/coreos/go-systemd/activation"
14 13
 	"github.com/docker/go-connections/sockets"
14
+	"github.com/sirupsen/logrus"
15 15
 )
16 16
 
17 17
 // Init creates new listeners for the server.
... ...
@@ -7,7 +7,7 @@ import (
7 7
 	"fmt"
8 8
 	"os"
9 9
 
10
-	"github.com/Sirupsen/logrus"
10
+	"github.com/sirupsen/logrus"
11 11
 	"golang.org/x/sys/unix"
12 12
 )
13 13
 
... ...
@@ -6,7 +6,7 @@ import (
6 6
 	"fmt"
7 7
 	"os"
8 8
 
9
-	"github.com/Sirupsen/logrus"
9
+	"github.com/sirupsen/logrus"
10 10
 	"golang.org/x/sys/unix"
11 11
 )
12 12
 
... ...
@@ -7,7 +7,7 @@ package kernel
7 7
 import (
8 8
 	"bytes"
9 9
 
10
-	"github.com/Sirupsen/logrus"
10
+	"github.com/sirupsen/logrus"
11 11
 )
12 12
 
13 13
 // GetKernelVersion gets the current kernel version.
... ...
@@ -3,7 +3,7 @@ package platform
3 3
 import (
4 4
 	"runtime"
5 5
 
6
-	"github.com/Sirupsen/logrus"
6
+	"github.com/sirupsen/logrus"
7 7
 )
8 8
 
9 9
 var (
... ...
@@ -9,10 +9,10 @@ import (
9 9
 	"net/url"
10 10
 	"time"
11 11
 
12
-	"github.com/Sirupsen/logrus"
13 12
 	"github.com/docker/docker/pkg/plugins/transport"
14 13
 	"github.com/docker/go-connections/sockets"
15 14
 	"github.com/docker/go-connections/tlsconfig"
15
+	"github.com/sirupsen/logrus"
16 16
 )
17 17
 
18 18
 const (
... ...
@@ -27,8 +27,8 @@ import (
27 27
 	"sync"
28 28
 	"time"
29 29
 
30
-	"github.com/Sirupsen/logrus"
31 30
 	"github.com/docker/go-connections/tlsconfig"
31
+	"github.com/sirupsen/logrus"
32 32
 )
33 33
 
34 34
 var (
... ...
@@ -11,8 +11,8 @@ import (
11 11
 	"syscall"
12 12
 	"time"
13 13
 
14
-	"github.com/Sirupsen/logrus"
15 14
 	"github.com/pkg/errors"
15
+	"github.com/sirupsen/logrus"
16 16
 )
17 17
 
18 18
 // Trap sets up a simplified signal "trap", appropriate for common
... ...
@@ -7,8 +7,8 @@ import (
7 7
 	"path"
8 8
 	"strings"
9 9
 
10
-	"github.com/Sirupsen/logrus"
11 10
 	"github.com/opencontainers/runc/libcontainer/cgroups"
11
+	"github.com/sirupsen/logrus"
12 12
 	"golang.org/x/sys/unix"
13 13
 )
14 14
 
... ...
@@ -3,7 +3,7 @@ package system
3 3
 import (
4 4
 	"unsafe"
5 5
 
6
-	"github.com/Sirupsen/logrus"
6
+	"github.com/sirupsen/logrus"
7 7
 	"golang.org/x/sys/windows"
8 8
 )
9 9
 
... ...
@@ -10,7 +10,7 @@ import (
10 10
 	"sync"
11 11
 
12 12
 	ansiterm "github.com/Azure/go-ansiterm"
13
-	"github.com/Sirupsen/logrus"
13
+	"github.com/sirupsen/logrus"
14 14
 )
15 15
 
16 16
 var logger *logrus.Logger
... ...
@@ -15,7 +15,6 @@ import (
15 15
 	"path/filepath"
16 16
 	"strings"
17 17
 
18
-	"github.com/Sirupsen/logrus"
19 18
 	"github.com/docker/distribution/manifest/schema2"
20 19
 	"github.com/docker/distribution/reference"
21 20
 	"github.com/docker/docker/api/types"
... ...
@@ -36,6 +35,7 @@ import (
36 36
 	refstore "github.com/docker/docker/reference"
37 37
 	"github.com/opencontainers/go-digest"
38 38
 	"github.com/pkg/errors"
39
+	"github.com/sirupsen/logrus"
39 40
 	"golang.org/x/net/context"
40 41
 )
41 42
 
... ...
@@ -7,7 +7,6 @@ import (
7 7
 	"os"
8 8
 	"path/filepath"
9 9
 
10
-	"github.com/Sirupsen/logrus"
11 10
 	"github.com/docker/docker/distribution/xfer"
12 11
 	"github.com/docker/docker/image"
13 12
 	"github.com/docker/docker/layer"
... ...
@@ -16,6 +15,7 @@ import (
16 16
 	"github.com/docker/docker/pkg/progress"
17 17
 	"github.com/opencontainers/go-digest"
18 18
 	"github.com/pkg/errors"
19
+	"github.com/sirupsen/logrus"
19 20
 	"golang.org/x/net/context"
20 21
 )
21 22
 
... ...
@@ -13,7 +13,6 @@ import (
13 13
 	"strings"
14 14
 	"sync"
15 15
 
16
-	"github.com/Sirupsen/logrus"
17 16
 	"github.com/docker/distribution/reference"
18 17
 	"github.com/docker/docker/api/types"
19 18
 	"github.com/docker/docker/image"
... ...
@@ -28,6 +27,7 @@ import (
28 28
 	"github.com/docker/docker/registry"
29 29
 	"github.com/opencontainers/go-digest"
30 30
 	"github.com/pkg/errors"
31
+	"github.com/sirupsen/logrus"
31 32
 )
32 33
 
33 34
 const configFileName = "config.json"
... ...
@@ -10,7 +10,6 @@ import (
10 10
 	"path/filepath"
11 11
 	"time"
12 12
 
13
-	"github.com/Sirupsen/logrus"
14 13
 	"github.com/docker/docker/api/types"
15 14
 	"github.com/docker/docker/daemon/initlayer"
16 15
 	"github.com/docker/docker/libcontainerd"
... ...
@@ -22,6 +21,7 @@ import (
22 22
 	"github.com/opencontainers/go-digest"
23 23
 	specs "github.com/opencontainers/runtime-spec/specs-go"
24 24
 	"github.com/pkg/errors"
25
+	"github.com/sirupsen/logrus"
25 26
 	"golang.org/x/sys/unix"
26 27
 )
27 28
 
... ...
@@ -4,12 +4,12 @@ import (
4 4
 	"fmt"
5 5
 	"strings"
6 6
 
7
-	"github.com/Sirupsen/logrus"
8 7
 	"github.com/docker/distribution/reference"
9 8
 	"github.com/docker/docker/pkg/plugingetter"
10 9
 	"github.com/docker/docker/pkg/plugins"
11 10
 	"github.com/docker/docker/plugin/v2"
12 11
 	"github.com/pkg/errors"
12
+	"github.com/sirupsen/logrus"
13 13
 )
14 14
 
15 15
 /* allowV1PluginsFallback determines daemon's support for V1 plugins.
... ...
@@ -8,12 +8,12 @@ import (
8 8
 	"strings"
9 9
 	"time"
10 10
 
11
-	"github.com/Sirupsen/logrus"
12 11
 	"github.com/docker/distribution/registry/client/auth"
13 12
 	"github.com/docker/distribution/registry/client/auth/challenge"
14 13
 	"github.com/docker/distribution/registry/client/transport"
15 14
 	"github.com/docker/docker/api/types"
16 15
 	registrytypes "github.com/docker/docker/api/types/registry"
16
+	"github.com/sirupsen/logrus"
17 17
 )
18 18
 
19 19
 const (
... ...
@@ -8,11 +8,11 @@ import (
8 8
 	"strconv"
9 9
 	"strings"
10 10
 
11
-	"github.com/Sirupsen/logrus"
12 11
 	"github.com/docker/distribution/reference"
13 12
 	registrytypes "github.com/docker/docker/api/types/registry"
14 13
 	"github.com/docker/docker/opts"
15 14
 	"github.com/pkg/errors"
15
+	"github.com/sirupsen/logrus"
16 16
 	"github.com/spf13/pflag"
17 17
 )
18 18
 
... ...
@@ -9,9 +9,9 @@ import (
9 9
 	"net/url"
10 10
 	"strings"
11 11
 
12
-	"github.com/Sirupsen/logrus"
13 12
 	"github.com/docker/distribution/registry/client/transport"
14 13
 	registrytypes "github.com/docker/docker/api/types/registry"
14
+	"github.com/sirupsen/logrus"
15 15
 )
16 16
 
17 17
 // V1Endpoint stores basic information about a V1 registry endpoint.
... ...
@@ -13,10 +13,10 @@ import (
13 13
 	"strings"
14 14
 	"time"
15 15
 
16
-	"github.com/Sirupsen/logrus"
17 16
 	"github.com/docker/distribution/registry/client/transport"
18 17
 	"github.com/docker/go-connections/sockets"
19 18
 	"github.com/docker/go-connections/tlsconfig"
19
+	"github.com/sirupsen/logrus"
20 20
 )
21 21
 
22 22
 var (
... ...
@@ -21,7 +21,7 @@ import (
21 21
 	registrytypes "github.com/docker/docker/api/types/registry"
22 22
 	"github.com/gorilla/mux"
23 23
 
24
-	"github.com/Sirupsen/logrus"
24
+	"github.com/sirupsen/logrus"
25 25
 )
26 26
 
27 27
 var (
... ...
@@ -6,7 +6,7 @@ import (
6 6
 	"net/http"
7 7
 	"time"
8 8
 
9
-	"github.com/Sirupsen/logrus"
9
+	"github.com/sirupsen/logrus"
10 10
 )
11 11
 
12 12
 type requestReader struct {
... ...
@@ -10,11 +10,11 @@ import (
10 10
 
11 11
 	"golang.org/x/net/context"
12 12
 
13
-	"github.com/Sirupsen/logrus"
14 13
 	"github.com/docker/distribution/reference"
15 14
 	"github.com/docker/distribution/registry/client/auth"
16 15
 	"github.com/docker/docker/api/types"
17 16
 	registrytypes "github.com/docker/docker/api/types/registry"
17
+	"github.com/sirupsen/logrus"
18 18
 )
19 19
 
20 20
 const (
... ...
@@ -18,7 +18,6 @@ import (
18 18
 	"strconv"
19 19
 	"strings"
20 20
 
21
-	"github.com/Sirupsen/logrus"
22 21
 	"github.com/docker/distribution/reference"
23 22
 	"github.com/docker/distribution/registry/api/errcode"
24 23
 	"github.com/docker/docker/api/types"
... ...
@@ -28,6 +27,7 @@ import (
28 28
 	"github.com/docker/docker/pkg/stringid"
29 29
 	"github.com/docker/docker/pkg/tarsum"
30 30
 	"github.com/docker/docker/registry/resumable"
31
+	"github.com/sirupsen/logrus"
31 32
 )
32 33
 
33 34
 var (
... ...
@@ -2,7 +2,6 @@
2 2
 github.com/Azure/go-ansiterm 388960b655244e76e24c75f48631564eaefade62
3 3
 github.com/Microsoft/hcsshim v0.5.25
4 4
 github.com/Microsoft/go-winio v0.4.2
5
-github.com/Sirupsen/logrus v0.11.0
6 5
 github.com/moby/buildkit fed5c1d9cee6f734f58f3addca6e8d1750df48a6
7 6
 github.com/davecgh/go-spew 346938d642f2ec3594ed81d874461961cd0faa76
8 7
 github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a
... ...
@@ -12,6 +11,7 @@ github.com/gorilla/mux v1.1
12 12
 github.com/jhowardmsft/opengcs v0.0.9
13 13
 github.com/kr/pty 5cf931ef8f
14 14
 github.com/mattn/go-shellwords v1.0.3
15
+github.com/sirupsen/logrus v1.0.1
15 16
 github.com/tchap/go-patricia v2.2.6
16 17
 github.com/vdemeester/shakers 24d7f1d6a71aa5d9cbe7390e4afb66b7eef9e1b3
17 18
 golang.org/x/net 7dcfb8076726a3fdd9353b6b8a1f1b6be6811bd6
18 19
deleted file mode 100644
... ...
@@ -1,21 +0,0 @@
1
-The MIT License (MIT)
2
-
3
-Copyright (c) 2014 Simon Eskildsen
4
-
5
-Permission is hereby granted, free of charge, to any person obtaining a copy
6
-of this software and associated documentation files (the "Software"), to deal
7
-in the Software without restriction, including without limitation the rights
8
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
-copies of the Software, and to permit persons to whom the Software is
10
-furnished to do so, subject to the following conditions:
11
-
12
-The above copyright notice and this permission notice shall be included in
13
-all copies or substantial portions of the Software.
14
-
15
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
-THE SOFTWARE.
22 1
deleted file mode 100644
... ...
@@ -1,425 +0,0 @@
1
-# Logrus <img src="http://i.imgur.com/hTeVwmJ.png" width="40" height="40" alt=":walrus:" class="emoji" title=":walrus:"/>&nbsp;[![Build Status](https://travis-ci.org/Sirupsen/logrus.svg?branch=master)](https://travis-ci.org/Sirupsen/logrus)&nbsp;[![GoDoc](https://godoc.org/github.com/Sirupsen/logrus?status.svg)](https://godoc.org/github.com/Sirupsen/logrus)
2
-
3
-Logrus is a structured logger for Go (golang), completely API compatible with
4
-the standard library logger. [Godoc][godoc]. **Please note the Logrus API is not
5
-yet stable (pre 1.0). Logrus itself is completely stable and has been used in
6
-many large deployments. The core API is unlikely to change much but please
7
-version control your Logrus to make sure you aren't fetching latest `master` on
8
-every build.**
9
-
10
-Nicely color-coded in development (when a TTY is attached, otherwise just
11
-plain text):
12
-
13
-![Colored](http://i.imgur.com/PY7qMwd.png)
14
-
15
-With `log.SetFormatter(&log.JSONFormatter{})`, for easy parsing by logstash
16
-or Splunk:
17
-
18
-```json
19
-{"animal":"walrus","level":"info","msg":"A group of walrus emerges from the
20
-ocean","size":10,"time":"2014-03-10 19:57:38.562264131 -0400 EDT"}
21
-
22
-{"level":"warning","msg":"The group's number increased tremendously!",
23
-"number":122,"omg":true,"time":"2014-03-10 19:57:38.562471297 -0400 EDT"}
24
-
25
-{"animal":"walrus","level":"info","msg":"A giant walrus appears!",
26
-"size":10,"time":"2014-03-10 19:57:38.562500591 -0400 EDT"}
27
-
28
-{"animal":"walrus","level":"info","msg":"Tremendously sized cow enters the ocean.",
29
-"size":9,"time":"2014-03-10 19:57:38.562527896 -0400 EDT"}
30
-
31
-{"level":"fatal","msg":"The ice breaks!","number":100,"omg":true,
32
-"time":"2014-03-10 19:57:38.562543128 -0400 EDT"}
33
-```
34
-
35
-With the default `log.SetFormatter(&log.TextFormatter{})` when a TTY is not
36
-attached, the output is compatible with the
37
-[logfmt](http://godoc.org/github.com/kr/logfmt) format:
38
-
39
-```text
40
-time="2015-03-26T01:27:38-04:00" level=debug msg="Started observing beach" animal=walrus number=8
41
-time="2015-03-26T01:27:38-04:00" level=info msg="A group of walrus emerges from the ocean" animal=walrus size=10
42
-time="2015-03-26T01:27:38-04:00" level=warning msg="The group's number increased tremendously!" number=122 omg=true
43
-time="2015-03-26T01:27:38-04:00" level=debug msg="Temperature changes" temperature=-4
44
-time="2015-03-26T01:27:38-04:00" level=panic msg="It's over 9000!" animal=orca size=9009
45
-time="2015-03-26T01:27:38-04:00" level=fatal msg="The ice breaks!" err=&{0x2082280c0 map[animal:orca size:9009] 2015-03-26 01:27:38.441574009 -0400 EDT panic It's over 9000!} number=100 omg=true
46
-exit status 1
47
-```
48
-
49
-#### Example
50
-
51
-The simplest way to use Logrus is simply the package-level exported logger:
52
-
53
-```go
54
-package main
55
-
56
-import (
57
-  log "github.com/Sirupsen/logrus"
58
-)
59
-
60
-func main() {
61
-  log.WithFields(log.Fields{
62
-    "animal": "walrus",
63
-  }).Info("A walrus appears")
64
-}
65
-```
66
-
67
-Note that it's completely api-compatible with the stdlib logger, so you can
68
-replace your `log` imports everywhere with `log "github.com/Sirupsen/logrus"`
69
-and you'll now have the flexibility of Logrus. You can customize it all you
70
-want:
71
-
72
-```go
73
-package main
74
-
75
-import (
76
-  "os"
77
-  log "github.com/Sirupsen/logrus"
78
-)
79
-
80
-func init() {
81
-  // Log as JSON instead of the default ASCII formatter.
82
-  log.SetFormatter(&log.JSONFormatter{})
83
-
84
-  // Output to stderr instead of stdout, could also be a file.
85
-  log.SetOutput(os.Stderr)
86
-
87
-  // Only log the warning severity or above.
88
-  log.SetLevel(log.WarnLevel)
89
-}
90
-
91
-func main() {
92
-  log.WithFields(log.Fields{
93
-    "animal": "walrus",
94
-    "size":   10,
95
-  }).Info("A group of walrus emerges from the ocean")
96
-
97
-  log.WithFields(log.Fields{
98
-    "omg":    true,
99
-    "number": 122,
100
-  }).Warn("The group's number increased tremendously!")
101
-
102
-  log.WithFields(log.Fields{
103
-    "omg":    true,
104
-    "number": 100,
105
-  }).Fatal("The ice breaks!")
106
-
107
-  // A common pattern is to re-use fields between logging statements by re-using
108
-  // the logrus.Entry returned from WithFields()
109
-  contextLogger := log.WithFields(log.Fields{
110
-    "common": "this is a common field",
111
-    "other": "I also should be logged always",
112
-  })
113
-
114
-  contextLogger.Info("I'll be logged with common and other field")
115
-  contextLogger.Info("Me too")
116
-}
117
-```
118
-
119
-For more advanced usage such as logging to multiple locations from the same
120
-application, you can also create an instance of the `logrus` Logger:
121
-
122
-```go
123
-package main
124
-
125
-import (
126
-  "github.com/Sirupsen/logrus"
127
-)
128
-
129
-// Create a new instance of the logger. You can have any number of instances.
130
-var log = logrus.New()
131
-
132
-func main() {
133
-  // The API for setting attributes is a little different than the package level
134
-  // exported logger. See Godoc.
135
-  log.Out = os.Stderr
136
-
137
-  log.WithFields(logrus.Fields{
138
-    "animal": "walrus",
139
-    "size":   10,
140
-  }).Info("A group of walrus emerges from the ocean")
141
-}
142
-```
143
-
144
-#### Fields
145
-
146
-Logrus encourages careful, structured logging though logging fields instead of
147
-long, unparseable error messages. For example, instead of: `log.Fatalf("Failed
148
-to send event %s to topic %s with key %d")`, you should log the much more
149
-discoverable:
150
-
151
-```go
152
-log.WithFields(log.Fields{
153
-  "event": event,
154
-  "topic": topic,
155
-  "key": key,
156
-}).Fatal("Failed to send event")
157
-```
158
-
159
-We've found this API forces you to think about logging in a way that produces
160
-much more useful logging messages. We've been in countless situations where just
161
-a single added field to a log statement that was already there would've saved us
162
-hours. The `WithFields` call is optional.
163
-
164
-In general, with Logrus using any of the `printf`-family functions should be
165
-seen as a hint you should add a field, however, you can still use the
166
-`printf`-family functions with Logrus.
167
-
168
-#### Hooks
169
-
170
-You can add hooks for logging levels. For example to send errors to an exception
171
-tracking service on `Error`, `Fatal` and `Panic`, info to StatsD or log to
172
-multiple places simultaneously, e.g. syslog.
173
-
174
-Logrus comes with [built-in hooks](hooks/). Add those, or your custom hook, in
175
-`init`:
176
-
177
-```go
178
-import (
179
-  log "github.com/Sirupsen/logrus"
180
-  "gopkg.in/gemnasium/logrus-airbrake-hook.v2" // the package is named "aibrake"
181
-  logrus_syslog "github.com/Sirupsen/logrus/hooks/syslog"
182
-  "log/syslog"
183
-)
184
-
185
-func init() {
186
-
187
-  // Use the Airbrake hook to report errors that have Error severity or above to
188
-  // an exception tracker. You can create custom hooks, see the Hooks section.
189
-  log.AddHook(airbrake.NewHook(123, "xyz", "production"))
190
-
191
-  hook, err := logrus_syslog.NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, "")
192
-  if err != nil {
193
-    log.Error("Unable to connect to local syslog daemon")
194
-  } else {
195
-    log.AddHook(hook)
196
-  }
197
-}
198
-```
199
-Note: Syslog hook also support connecting to local syslog (Ex. "/dev/log" or "/var/run/syslog" or "/var/run/log"). For the detail, please check the [syslog hook README](hooks/syslog/README.md).
200
-
201
-| Hook  | Description |
202
-| ----- | ----------- |
203
-| [Airbrake](https://github.com/gemnasium/logrus-airbrake-hook) | Send errors to the Airbrake API V3. Uses the official [`gobrake`](https://github.com/airbrake/gobrake) behind the scenes. |
204
-| [Airbrake "legacy"](https://github.com/gemnasium/logrus-airbrake-legacy-hook) | Send errors to an exception tracking service compatible with the Airbrake API V2. Uses [`airbrake-go`](https://github.com/tobi/airbrake-go) behind the scenes. |
205
-| [Papertrail](https://github.com/polds/logrus-papertrail-hook) | Send errors to the [Papertrail](https://papertrailapp.com) hosted logging service via UDP. |
206
-| [Syslog](https://github.com/Sirupsen/logrus/blob/master/hooks/syslog/syslog.go) | Send errors to remote syslog server. Uses standard library `log/syslog` behind the scenes. |
207
-| [Bugsnag](https://github.com/Shopify/logrus-bugsnag/blob/master/bugsnag.go) | Send errors to the Bugsnag exception tracking service. |
208
-| [Sentry](https://github.com/evalphobia/logrus_sentry) | Send errors to the Sentry error logging and aggregation service. |
209
-| [Hiprus](https://github.com/nubo/hiprus) | Send errors to a channel in hipchat. |
210
-| [Logrusly](https://github.com/sebest/logrusly) | Send logs to [Loggly](https://www.loggly.com/) |
211
-| [Slackrus](https://github.com/johntdyer/slackrus) | Hook for Slack chat. |
212
-| [Journalhook](https://github.com/wercker/journalhook) | Hook for logging to `systemd-journald` |
213
-| [Graylog](https://github.com/gemnasium/logrus-graylog-hook) | Hook for logging to [Graylog](http://graylog2.org/) |
214
-| [Raygun](https://github.com/squirkle/logrus-raygun-hook) | Hook for logging to [Raygun.io](http://raygun.io/) |
215
-| [LFShook](https://github.com/rifflock/lfshook) | Hook for logging to the local filesystem |
216
-| [Honeybadger](https://github.com/agonzalezro/logrus_honeybadger) | Hook for sending exceptions to Honeybadger |
217
-| [Mail](https://github.com/zbindenren/logrus_mail) | Hook for sending exceptions via mail |
218
-| [Rollrus](https://github.com/heroku/rollrus) | Hook for sending errors to rollbar |
219
-| [Fluentd](https://github.com/evalphobia/logrus_fluent) | Hook for logging to fluentd |
220
-| [Mongodb](https://github.com/weekface/mgorus) | Hook for logging to mongodb |
221
-| [Influxus] (http://github.com/vlad-doru/influxus) | Hook for concurrently logging to [InfluxDB] (http://influxdata.com/) |
222
-| [InfluxDB](https://github.com/Abramovic/logrus_influxdb) | Hook for logging to influxdb |
223
-| [Octokit](https://github.com/dorajistyle/logrus-octokit-hook) | Hook for logging to github via octokit |
224
-| [DeferPanic](https://github.com/deferpanic/dp-logrus) | Hook for logging to DeferPanic |
225
-| [Redis-Hook](https://github.com/rogierlommers/logrus-redis-hook) | Hook for logging to a ELK stack (through Redis) |
226
-| [Amqp-Hook](https://github.com/vladoatanasov/logrus_amqp) | Hook for logging to Amqp broker (Like RabbitMQ) |
227
-| [KafkaLogrus](https://github.com/goibibo/KafkaLogrus) | Hook for logging to kafka |
228
-| [Typetalk](https://github.com/dragon3/logrus-typetalk-hook) | Hook for logging to [Typetalk](https://www.typetalk.in/) |
229
-| [ElasticSearch](https://github.com/sohlich/elogrus) | Hook for logging to ElasticSearch|
230
-| [Sumorus](https://github.com/doublefree/sumorus) | Hook for logging to [SumoLogic](https://www.sumologic.com/)|
231
-| [Scribe](https://github.com/sagar8192/logrus-scribe-hook) | Hook for logging to [Scribe](https://github.com/facebookarchive/scribe)|
232
-| [Logstash](https://github.com/bshuster-repo/logrus-logstash-hook) | Hook for logging to [Logstash](https://www.elastic.co/products/logstash) |
233
-| [logz.io](https://github.com/ripcurld00d/logrus-logzio-hook) | Hook for logging to [logz.io](https://logz.io), a Log as a Service using Logstash |
234
-| [Logmatic.io](https://github.com/logmatic/logmatic-go) | Hook for logging to [Logmatic.io](http://logmatic.io/) |
235
-| [Pushover](https://github.com/toorop/logrus_pushover) | Send error via [Pushover](https://pushover.net) |
236
-
237
-
238
-#### Level logging
239
-
240
-Logrus has six logging levels: Debug, Info, Warning, Error, Fatal and Panic.
241
-
242
-```go
243
-log.Debug("Useful debugging information.")
244
-log.Info("Something noteworthy happened!")
245
-log.Warn("You should probably take a look at this.")
246
-log.Error("Something failed but I'm not quitting.")
247
-// Calls os.Exit(1) after logging
248
-log.Fatal("Bye.")
249
-// Calls panic() after logging
250
-log.Panic("I'm bailing.")
251
-```
252
-
253
-You can set the logging level on a `Logger`, then it will only log entries with
254
-that severity or anything above it:
255
-
256
-```go
257
-// Will log anything that is info or above (warn, error, fatal, panic). Default.
258
-log.SetLevel(log.InfoLevel)
259
-```
260
-
261
-It may be useful to set `log.Level = logrus.DebugLevel` in a debug or verbose
262
-environment if your application has that.
263
-
264
-#### Entries
265
-
266
-Besides the fields added with `WithField` or `WithFields` some fields are
267
-automatically added to all logging events:
268
-
269
-1. `time`. The timestamp when the entry was created.
270
-2. `msg`. The logging message passed to `{Info,Warn,Error,Fatal,Panic}` after
271
-   the `AddFields` call. E.g. `Failed to send event.`
272
-3. `level`. The logging level. E.g. `info`.
273
-
274
-#### Environments
275
-
276
-Logrus has no notion of environment.
277
-
278
-If you wish for hooks and formatters to only be used in specific environments,
279
-you should handle that yourself. For example, if your application has a global
280
-variable `Environment`, which is a string representation of the environment you
281
-could do:
282
-
283
-```go
284
-import (
285
-  log "github.com/Sirupsen/logrus"
286
-)
287
-
288
-init() {
289
-  // do something here to set environment depending on an environment variable
290
-  // or command-line flag
291
-  if Environment == "production" {
292
-    log.SetFormatter(&log.JSONFormatter{})
293
-  } else {
294
-    // The TextFormatter is default, you don't actually have to do this.
295
-    log.SetFormatter(&log.TextFormatter{})
296
-  }
297
-}
298
-```
299
-
300
-This configuration is how `logrus` was intended to be used, but JSON in
301
-production is mostly only useful if you do log aggregation with tools like
302
-Splunk or Logstash.
303
-
304
-#### Formatters
305
-
306
-The built-in logging formatters are:
307
-
308
-* `logrus.TextFormatter`. Logs the event in colors if stdout is a tty, otherwise
309
-  without colors.
310
-  * *Note:* to force colored output when there is no TTY, set the `ForceColors`
311
-    field to `true`.  To force no colored output even if there is a TTY  set the
312
-    `DisableColors` field to `true`
313
-* `logrus.JSONFormatter`. Logs fields as JSON.
314
-
315
-Third party logging formatters:
316
-
317
-* [`logstash`](https://github.com/bshuster-repo/logrus-logstash-hook). Logs fields as [Logstash](http://logstash.net) Events.
318
-* [`prefixed`](https://github.com/x-cray/logrus-prefixed-formatter). Displays log entry source along with alternative layout.
319
-* [`zalgo`](https://github.com/aybabtme/logzalgo). Invoking the P͉̫o̳̼̊w̖͈̰͎e̬͔̭͂r͚̼̹̲ ̫͓͉̳͈ō̠͕͖̚f̝͍̠ ͕̲̞͖͑Z̖̫̤̫ͪa͉̬͈̗l͖͎g̳̥o̰̥̅!̣͔̲̻͊̄ ̙̘̦̹̦.
320
-
321
-You can define your formatter by implementing the `Formatter` interface,
322
-requiring a `Format` method. `Format` takes an `*Entry`. `entry.Data` is a
323
-`Fields` type (`map[string]interface{}`) with all your fields as well as the
324
-default ones (see Entries section above):
325
-
326
-```go
327
-type MyJSONFormatter struct {
328
-}
329
-
330
-log.SetFormatter(new(MyJSONFormatter))
331
-
332
-func (f *MyJSONFormatter) Format(entry *Entry) ([]byte, error) {
333
-  // Note this doesn't include Time, Level and Message which are available on
334
-  // the Entry. Consult `godoc` on information about those fields or read the
335
-  // source of the official loggers.
336
-  serialized, err := json.Marshal(entry.Data)
337
-    if err != nil {
338
-      return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err)
339
-    }
340
-  return append(serialized, '\n'), nil
341
-}
342
-```
343
-
344
-#### Logger as an `io.Writer`
345
-
346
-Logrus can be transformed into an `io.Writer`. That writer is the end of an `io.Pipe` and it is your responsibility to close it.
347
-
348
-```go
349
-w := logger.Writer()
350
-defer w.Close()
351
-
352
-srv := http.Server{
353
-    // create a stdlib log.Logger that writes to
354
-    // logrus.Logger.
355
-    ErrorLog: log.New(w, "", 0),
356
-}
357
-```
358
-
359
-Each line written to that writer will be printed the usual way, using formatters
360
-and hooks. The level for those entries is `info`.
361
-
362
-#### Rotation
363
-
364
-Log rotation is not provided with Logrus. Log rotation should be done by an
365
-external program (like `logrotate(8)`) that can compress and delete old log
366
-entries. It should not be a feature of the application-level logger.
367
-
368
-#### Tools
369
-
370
-| Tool | Description |
371
-| ---- | ----------- |
372
-|[Logrus Mate](https://github.com/gogap/logrus_mate)|Logrus mate is a tool for Logrus to manage loggers, you can initial logger's level, hook and formatter by config file, the logger will generated with different config at different environment.|
373
-|[Logrus Viper Helper](https://github.com/heirko/go-contrib/tree/master/logrusHelper)|An Helper arround Logrus to wrap with spf13/Viper to load configuration with fangs! And to simplify Logrus configuration use some behavior of [Logrus Mate](https://github.com/gogap/logrus_mate). [sample](https://github.com/heirko/iris-contrib/blob/master/middleware/logrus-logger/example) |
374
-
375
-#### Testing
376
-
377
-Logrus has a built in facility for asserting the presence of log messages. This is implemented through the `test` hook and provides:
378
-
379
-* decorators for existing logger (`test.NewLocal` and `test.NewGlobal`) which basically just add the `test` hook
380
-* a test logger (`test.NewNullLogger`) that just records log messages (and does not output any):
381
-
382
-```go
383
-logger, hook := NewNullLogger()
384
-logger.Error("Hello error")
385
-
386
-assert.Equal(1, len(hook.Entries))
387
-assert.Equal(logrus.ErrorLevel, hook.LastEntry().Level)
388
-assert.Equal("Hello error", hook.LastEntry().Message)
389
-
390
-hook.Reset()
391
-assert.Nil(hook.LastEntry())
392
-```
393
-
394
-#### Fatal handlers
395
-
396
-Logrus can register one or more functions that will be called when any `fatal`
397
-level message is logged. The registered handlers will be executed before
398
-logrus performs a `os.Exit(1)`. This behavior may be helpful if callers need
399
-to gracefully shutdown. Unlike a `panic("Something went wrong...")` call which can be intercepted with a deferred `recover` a call to `os.Exit(1)` can not be intercepted.
400
-
401
-```
402
-...
403
-handler := func() {
404
-  // gracefully shutdown something...
405
-}
406
-logrus.RegisterExitHandler(handler)
407
-...
408
-```
409
-
410
-#### Thread safty
411
-
412
-By default Logger is protected by mutex for concurrent writes, this mutex is invoked when calling hooks and writing logs.
413
-If you are sure such locking is not needed, you can call logger.SetNoLock() to disable the locking.
414
-
415
-Situation when locking is not needed includes:
416
-
417
-* You have no hooks registered, or hooks calling is already thread-safe.
418
-
419
-* Writing to logger.Out is already thread-safe, for example:
420
-
421
-  1) logger.Out is protected by locks.
422
-
423
-  2) logger.Out is a os.File handler opened with `O_APPEND` flag, and every write is smaller than 4k. (This allow multi-thread/multi-process writing)
424
-
425
-     (Refer to http://www.notthewizard.com/2014/06/17/are-files-appends-really-atomic/)
426 1
deleted file mode 100644
... ...
@@ -1,64 +0,0 @@
1
-package logrus
2
-
3
-// The following code was sourced and modified from the
4
-// https://bitbucket.org/tebeka/atexit package governed by the following license:
5
-//
6
-// Copyright (c) 2012 Miki Tebeka <miki.tebeka@gmail.com>.
7
-//
8
-// Permission is hereby granted, free of charge, to any person obtaining a copy of
9
-// this software and associated documentation files (the "Software"), to deal in
10
-// the Software without restriction, including without limitation the rights to
11
-// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
12
-// the Software, and to permit persons to whom the Software is furnished to do so,
13
-// subject to the following conditions:
14
-//
15
-// The above copyright notice and this permission notice shall be included in all
16
-// copies or substantial portions of the Software.
17
-//
18
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
20
-// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
21
-// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
22
-// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23
-// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
-
25
-import (
26
-	"fmt"
27
-	"os"
28
-)
29
-
30
-var handlers = []func(){}
31
-
32
-func runHandler(handler func()) {
33
-	defer func() {
34
-		if err := recover(); err != nil {
35
-			fmt.Fprintln(os.Stderr, "Error: Logrus exit handler error:", err)
36
-		}
37
-	}()
38
-
39
-	handler()
40
-}
41
-
42
-func runHandlers() {
43
-	for _, handler := range handlers {
44
-		runHandler(handler)
45
-	}
46
-}
47
-
48
-// Exit runs all the Logrus atexit handlers and then terminates the program using os.Exit(code)
49
-func Exit(code int) {
50
-	runHandlers()
51
-	os.Exit(code)
52
-}
53
-
54
-// RegisterExitHandler adds a Logrus Exit handler, call logrus.Exit to invoke
55
-// all handlers. The handlers will also be invoked when any Fatal log entry is
56
-// made.
57
-//
58
-// This method is useful when a caller wishes to use logrus to log a fatal
59
-// message but also needs to gracefully shutdown. An example usecase could be
60
-// closing database connections, or sending a alert that the application is
61
-// closing.
62
-func RegisterExitHandler(handler func()) {
63
-	handlers = append(handlers, handler)
64
-}
65 1
deleted file mode 100644
... ...
@@ -1,26 +0,0 @@
1
-/*
2
-Package logrus is a structured logger for Go, completely API compatible with the standard library logger.
3
-
4
-
5
-The simplest way to use Logrus is simply the package-level exported logger:
6
-
7
-  package main
8
-
9
-  import (
10
-    log "github.com/Sirupsen/logrus"
11
-  )
12
-
13
-  func main() {
14
-    log.WithFields(log.Fields{
15
-      "animal": "walrus",
16
-      "number": 1,
17
-      "size":   10,
18
-    }).Info("A walrus appears")
19
-  }
20
-
21
-Output:
22
-  time="2015-09-07T08:48:33Z" level=info msg="A walrus appears" animal=walrus number=1 size=10
23
-
24
-For a full guide visit https://github.com/Sirupsen/logrus
25
-*/
26
-package logrus
27 1
deleted file mode 100644
... ...
@@ -1,275 +0,0 @@
1
-package logrus
2
-
3
-import (
4
-	"bytes"
5
-	"fmt"
6
-	"os"
7
-	"sync"
8
-	"time"
9
-)
10
-
11
-var bufferPool *sync.Pool
12
-
13
-func init() {
14
-	bufferPool = &sync.Pool{
15
-		New: func() interface{} {
16
-			return new(bytes.Buffer)
17
-		},
18
-	}
19
-}
20
-
21
-// Defines the key when adding errors using WithError.
22
-var ErrorKey = "error"
23
-
24
-// An entry is the final or intermediate Logrus logging entry. It contains all
25
-// the fields passed with WithField{,s}. It's finally logged when Debug, Info,
26
-// Warn, Error, Fatal or Panic is called on it. These objects can be reused and
27
-// passed around as much as you wish to avoid field duplication.
28
-type Entry struct {
29
-	Logger *Logger
30
-
31
-	// Contains all the fields set by the user.
32
-	Data Fields
33
-
34
-	// Time at which the log entry was created
35
-	Time time.Time
36
-
37
-	// Level the log entry was logged at: Debug, Info, Warn, Error, Fatal or Panic
38
-	Level Level
39
-
40
-	// Message passed to Debug, Info, Warn, Error, Fatal or Panic
41
-	Message string
42
-
43
-	// When formatter is called in entry.log(), an Buffer may be set to entry
44
-	Buffer *bytes.Buffer
45
-}
46
-
47
-func NewEntry(logger *Logger) *Entry {
48
-	return &Entry{
49
-		Logger: logger,
50
-		// Default is three fields, give a little extra room
51
-		Data: make(Fields, 5),
52
-	}
53
-}
54
-
55
-// Returns the string representation from the reader and ultimately the
56
-// formatter.
57
-func (entry *Entry) String() (string, error) {
58
-	serialized, err := entry.Logger.Formatter.Format(entry)
59
-	if err != nil {
60
-		return "", err
61
-	}
62
-	str := string(serialized)
63
-	return str, nil
64
-}
65
-
66
-// Add an error as single field (using the key defined in ErrorKey) to the Entry.
67
-func (entry *Entry) WithError(err error) *Entry {
68
-	return entry.WithField(ErrorKey, err)
69
-}
70
-
71
-// Add a single field to the Entry.
72
-func (entry *Entry) WithField(key string, value interface{}) *Entry {
73
-	return entry.WithFields(Fields{key: value})
74
-}
75
-
76
-// Add a map of fields to the Entry.
77
-func (entry *Entry) WithFields(fields Fields) *Entry {
78
-	data := make(Fields, len(entry.Data)+len(fields))
79
-	for k, v := range entry.Data {
80
-		data[k] = v
81
-	}
82
-	for k, v := range fields {
83
-		data[k] = v
84
-	}
85
-	return &Entry{Logger: entry.Logger, Data: data}
86
-}
87
-
88
-// This function is not declared with a pointer value because otherwise
89
-// race conditions will occur when using multiple goroutines
90
-func (entry Entry) log(level Level, msg string) {
91
-	var buffer *bytes.Buffer
92
-	entry.Time = time.Now()
93
-	entry.Level = level
94
-	entry.Message = msg
95
-
96
-	if err := entry.Logger.Hooks.Fire(level, &entry); err != nil {
97
-		entry.Logger.mu.Lock()
98
-		fmt.Fprintf(os.Stderr, "Failed to fire hook: %v\n", err)
99
-		entry.Logger.mu.Unlock()
100
-	}
101
-	buffer = bufferPool.Get().(*bytes.Buffer)
102
-	buffer.Reset()
103
-	defer bufferPool.Put(buffer)
104
-	entry.Buffer = buffer
105
-	serialized, err := entry.Logger.Formatter.Format(&entry)
106
-	entry.Buffer = nil
107
-	if err != nil {
108
-		entry.Logger.mu.Lock()
109
-		fmt.Fprintf(os.Stderr, "Failed to obtain reader, %v\n", err)
110
-		entry.Logger.mu.Unlock()
111
-	} else {
112
-		entry.Logger.mu.Lock()
113
-		_, err = entry.Logger.Out.Write(serialized)
114
-		if err != nil {
115
-			fmt.Fprintf(os.Stderr, "Failed to write to log, %v\n", err)
116
-		}
117
-		entry.Logger.mu.Unlock()
118
-	}
119
-
120
-	// To avoid Entry#log() returning a value that only would make sense for
121
-	// panic() to use in Entry#Panic(), we avoid the allocation by checking
122
-	// directly here.
123
-	if level <= PanicLevel {
124
-		panic(&entry)
125
-	}
126
-}
127
-
128
-func (entry *Entry) Debug(args ...interface{}) {
129
-	if entry.Logger.Level >= DebugLevel {
130
-		entry.log(DebugLevel, fmt.Sprint(args...))
131
-	}
132
-}
133
-
134
-func (entry *Entry) Print(args ...interface{}) {
135
-	entry.Info(args...)
136
-}
137
-
138
-func (entry *Entry) Info(args ...interface{}) {
139
-	if entry.Logger.Level >= InfoLevel {
140
-		entry.log(InfoLevel, fmt.Sprint(args...))
141
-	}
142
-}
143
-
144
-func (entry *Entry) Warn(args ...interface{}) {
145
-	if entry.Logger.Level >= WarnLevel {
146
-		entry.log(WarnLevel, fmt.Sprint(args...))
147
-	}
148
-}
149
-
150
-func (entry *Entry) Warning(args ...interface{}) {
151
-	entry.Warn(args...)
152
-}
153
-
154
-func (entry *Entry) Error(args ...interface{}) {
155
-	if entry.Logger.Level >= ErrorLevel {
156
-		entry.log(ErrorLevel, fmt.Sprint(args...))
157
-	}
158
-}
159
-
160
-func (entry *Entry) Fatal(args ...interface{}) {
161
-	if entry.Logger.Level >= FatalLevel {
162
-		entry.log(FatalLevel, fmt.Sprint(args...))
163
-	}
164
-	Exit(1)
165
-}
166
-
167
-func (entry *Entry) Panic(args ...interface{}) {
168
-	if entry.Logger.Level >= PanicLevel {
169
-		entry.log(PanicLevel, fmt.Sprint(args...))
170
-	}
171
-	panic(fmt.Sprint(args...))
172
-}
173
-
174
-// Entry Printf family functions
175
-
176
-func (entry *Entry) Debugf(format string, args ...interface{}) {
177
-	if entry.Logger.Level >= DebugLevel {
178
-		entry.Debug(fmt.Sprintf(format, args...))
179
-	}
180
-}
181
-
182
-func (entry *Entry) Infof(format string, args ...interface{}) {
183
-	if entry.Logger.Level >= InfoLevel {
184
-		entry.Info(fmt.Sprintf(format, args...))
185
-	}
186
-}
187
-
188
-func (entry *Entry) Printf(format string, args ...interface{}) {
189
-	entry.Infof(format, args...)
190
-}
191
-
192
-func (entry *Entry) Warnf(format string, args ...interface{}) {
193
-	if entry.Logger.Level >= WarnLevel {
194
-		entry.Warn(fmt.Sprintf(format, args...))
195
-	}
196
-}
197
-
198
-func (entry *Entry) Warningf(format string, args ...interface{}) {
199
-	entry.Warnf(format, args...)
200
-}
201
-
202
-func (entry *Entry) Errorf(format string, args ...interface{}) {
203
-	if entry.Logger.Level >= ErrorLevel {
204
-		entry.Error(fmt.Sprintf(format, args...))
205
-	}
206
-}
207
-
208
-func (entry *Entry) Fatalf(format string, args ...interface{}) {
209
-	if entry.Logger.Level >= FatalLevel {
210
-		entry.Fatal(fmt.Sprintf(format, args...))
211
-	}
212
-	Exit(1)
213
-}
214
-
215
-func (entry *Entry) Panicf(format string, args ...interface{}) {
216
-	if entry.Logger.Level >= PanicLevel {
217
-		entry.Panic(fmt.Sprintf(format, args...))
218
-	}
219
-}
220
-
221
-// Entry Println family functions
222
-
223
-func (entry *Entry) Debugln(args ...interface{}) {
224
-	if entry.Logger.Level >= DebugLevel {
225
-		entry.Debug(entry.sprintlnn(args...))
226
-	}
227
-}
228
-
229
-func (entry *Entry) Infoln(args ...interface{}) {
230
-	if entry.Logger.Level >= InfoLevel {
231
-		entry.Info(entry.sprintlnn(args...))
232
-	}
233
-}
234
-
235
-func (entry *Entry) Println(args ...interface{}) {
236
-	entry.Infoln(args...)
237
-}
238
-
239
-func (entry *Entry) Warnln(args ...interface{}) {
240
-	if entry.Logger.Level >= WarnLevel {
241
-		entry.Warn(entry.sprintlnn(args...))
242
-	}
243
-}
244
-
245
-func (entry *Entry) Warningln(args ...interface{}) {
246
-	entry.Warnln(args...)
247
-}
248
-
249
-func (entry *Entry) Errorln(args ...interface{}) {
250
-	if entry.Logger.Level >= ErrorLevel {
251
-		entry.Error(entry.sprintlnn(args...))
252
-	}
253
-}
254
-
255
-func (entry *Entry) Fatalln(args ...interface{}) {
256
-	if entry.Logger.Level >= FatalLevel {
257
-		entry.Fatal(entry.sprintlnn(args...))
258
-	}
259
-	Exit(1)
260
-}
261
-
262
-func (entry *Entry) Panicln(args ...interface{}) {
263
-	if entry.Logger.Level >= PanicLevel {
264
-		entry.Panic(entry.sprintlnn(args...))
265
-	}
266
-}
267
-
268
-// Sprintlnn => Sprint no newline. This is to get the behavior of how
269
-// fmt.Sprintln where spaces are always added between operands, regardless of
270
-// their type. Instead of vendoring the Sprintln implementation to spare a
271
-// string allocation, we do the simplest thing.
272
-func (entry *Entry) sprintlnn(args ...interface{}) string {
273
-	msg := fmt.Sprintln(args...)
274
-	return msg[:len(msg)-1]
275
-}
276 1
deleted file mode 100644
... ...
@@ -1,193 +0,0 @@
1
-package logrus
2
-
3
-import (
4
-	"io"
5
-)
6
-
7
-var (
8
-	// std is the name of the standard logger in stdlib `log`
9
-	std = New()
10
-)
11
-
12
-func StandardLogger() *Logger {
13
-	return std
14
-}
15
-
16
-// SetOutput sets the standard logger output.
17
-func SetOutput(out io.Writer) {
18
-	std.mu.Lock()
19
-	defer std.mu.Unlock()
20
-	std.Out = out
21
-}
22
-
23
-// SetFormatter sets the standard logger formatter.
24
-func SetFormatter(formatter Formatter) {
25
-	std.mu.Lock()
26
-	defer std.mu.Unlock()
27
-	std.Formatter = formatter
28
-}
29
-
30
-// SetLevel sets the standard logger level.
31
-func SetLevel(level Level) {
32
-	std.mu.Lock()
33
-	defer std.mu.Unlock()
34
-	std.Level = level
35
-}
36
-
37
-// GetLevel returns the standard logger level.
38
-func GetLevel() Level {
39
-	std.mu.Lock()
40
-	defer std.mu.Unlock()
41
-	return std.Level
42
-}
43
-
44
-// AddHook adds a hook to the standard logger hooks.
45
-func AddHook(hook Hook) {
46
-	std.mu.Lock()
47
-	defer std.mu.Unlock()
48
-	std.Hooks.Add(hook)
49
-}
50
-
51
-// WithError creates an entry from the standard logger and adds an error to it, using the value defined in ErrorKey as key.
52
-func WithError(err error) *Entry {
53
-	return std.WithField(ErrorKey, err)
54
-}
55
-
56
-// WithField creates an entry from the standard logger and adds a field to
57
-// it. If you want multiple fields, use `WithFields`.
58
-//
59
-// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal
60
-// or Panic on the Entry it returns.
61
-func WithField(key string, value interface{}) *Entry {
62
-	return std.WithField(key, value)
63
-}
64
-
65
-// WithFields creates an entry from the standard logger and adds multiple
66
-// fields to it. This is simply a helper for `WithField`, invoking it
67
-// once for each field.
68
-//
69
-// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal
70
-// or Panic on the Entry it returns.
71
-func WithFields(fields Fields) *Entry {
72
-	return std.WithFields(fields)
73
-}
74
-
75
-// Debug logs a message at level Debug on the standard logger.
76
-func Debug(args ...interface{}) {
77
-	std.Debug(args...)
78
-}
79
-
80
-// Print logs a message at level Info on the standard logger.
81
-func Print(args ...interface{}) {
82
-	std.Print(args...)
83
-}
84
-
85
-// Info logs a message at level Info on the standard logger.
86
-func Info(args ...interface{}) {
87
-	std.Info(args...)
88
-}
89
-
90
-// Warn logs a message at level Warn on the standard logger.
91
-func Warn(args ...interface{}) {
92
-	std.Warn(args...)
93
-}
94
-
95
-// Warning logs a message at level Warn on the standard logger.
96
-func Warning(args ...interface{}) {
97
-	std.Warning(args...)
98
-}
99
-
100
-// Error logs a message at level Error on the standard logger.
101
-func Error(args ...interface{}) {
102
-	std.Error(args...)
103
-}
104
-
105
-// Panic logs a message at level Panic on the standard logger.
106
-func Panic(args ...interface{}) {
107
-	std.Panic(args...)
108
-}
109
-
110
-// Fatal logs a message at level Fatal on the standard logger.
111
-func Fatal(args ...interface{}) {
112
-	std.Fatal(args...)
113
-}
114
-
115
-// Debugf logs a message at level Debug on the standard logger.
116
-func Debugf(format string, args ...interface{}) {
117
-	std.Debugf(format, args...)
118
-}
119
-
120
-// Printf logs a message at level Info on the standard logger.
121
-func Printf(format string, args ...interface{}) {
122
-	std.Printf(format, args...)
123
-}
124
-
125
-// Infof logs a message at level Info on the standard logger.
126
-func Infof(format string, args ...interface{}) {
127
-	std.Infof(format, args...)
128
-}
129
-
130
-// Warnf logs a message at level Warn on the standard logger.
131
-func Warnf(format string, args ...interface{}) {
132
-	std.Warnf(format, args...)
133
-}
134
-
135
-// Warningf logs a message at level Warn on the standard logger.
136
-func Warningf(format string, args ...interface{}) {
137
-	std.Warningf(format, args...)
138
-}
139
-
140
-// Errorf logs a message at level Error on the standard logger.
141
-func Errorf(format string, args ...interface{}) {
142
-	std.Errorf(format, args...)
143
-}
144
-
145
-// Panicf logs a message at level Panic on the standard logger.
146
-func Panicf(format string, args ...interface{}) {
147
-	std.Panicf(format, args...)
148
-}
149
-
150
-// Fatalf logs a message at level Fatal on the standard logger.
151
-func Fatalf(format string, args ...interface{}) {
152
-	std.Fatalf(format, args...)
153
-}
154
-
155
-// Debugln logs a message at level Debug on the standard logger.
156
-func Debugln(args ...interface{}) {
157
-	std.Debugln(args...)
158
-}
159
-
160
-// Println logs a message at level Info on the standard logger.
161
-func Println(args ...interface{}) {
162
-	std.Println(args...)
163
-}
164
-
165
-// Infoln logs a message at level Info on the standard logger.
166
-func Infoln(args ...interface{}) {
167
-	std.Infoln(args...)
168
-}
169
-
170
-// Warnln logs a message at level Warn on the standard logger.
171
-func Warnln(args ...interface{}) {
172
-	std.Warnln(args...)
173
-}
174
-
175
-// Warningln logs a message at level Warn on the standard logger.
176
-func Warningln(args ...interface{}) {
177
-	std.Warningln(args...)
178
-}
179
-
180
-// Errorln logs a message at level Error on the standard logger.
181
-func Errorln(args ...interface{}) {
182
-	std.Errorln(args...)
183
-}
184
-
185
-// Panicln logs a message at level Panic on the standard logger.
186
-func Panicln(args ...interface{}) {
187
-	std.Panicln(args...)
188
-}
189
-
190
-// Fatalln logs a message at level Fatal on the standard logger.
191
-func Fatalln(args ...interface{}) {
192
-	std.Fatalln(args...)
193
-}
194 1
deleted file mode 100644
... ...
@@ -1,45 +0,0 @@
1
-package logrus
2
-
3
-import "time"
4
-
5
-const DefaultTimestampFormat = time.RFC3339
6
-
7
-// The Formatter interface is used to implement a custom Formatter. It takes an
8
-// `Entry`. It exposes all the fields, including the default ones:
9
-//
10
-// * `entry.Data["msg"]`. The message passed from Info, Warn, Error ..
11
-// * `entry.Data["time"]`. The timestamp.
12
-// * `entry.Data["level"]. The level the entry was logged at.
13
-//
14
-// Any additional fields added with `WithField` or `WithFields` are also in
15
-// `entry.Data`. Format is expected to return an array of bytes which are then
16
-// logged to `logger.Out`.
17
-type Formatter interface {
18
-	Format(*Entry) ([]byte, error)
19
-}
20
-
21
-// This is to not silently overwrite `time`, `msg` and `level` fields when
22
-// dumping it. If this code wasn't there doing:
23
-//
24
-//  logrus.WithField("level", 1).Info("hello")
25
-//
26
-// Would just silently drop the user provided level. Instead with this code
27
-// it'll logged as:
28
-//
29
-//  {"level": "info", "fields.level": 1, "msg": "hello", "time": "..."}
30
-//
31
-// It's not exported because it's still using Data in an opinionated way. It's to
32
-// avoid code duplication between the two default formatters.
33
-func prefixFieldClashes(data Fields) {
34
-	if t, ok := data["time"]; ok {
35
-		data["fields.time"] = t
36
-	}
37
-
38
-	if m, ok := data["msg"]; ok {
39
-		data["fields.msg"] = m
40
-	}
41
-
42
-	if l, ok := data["level"]; ok {
43
-		data["fields.level"] = l
44
-	}
45
-}
46 1
deleted file mode 100644
... ...
@@ -1,34 +0,0 @@
1
-package logrus
2
-
3
-// A hook to be fired when logging on the logging levels returned from
4
-// `Levels()` on your implementation of the interface. Note that this is not
5
-// fired in a goroutine or a channel with workers, you should handle such
6
-// functionality yourself if your call is non-blocking and you don't wish for
7
-// the logging calls for levels returned from `Levels()` to block.
8
-type Hook interface {
9
-	Levels() []Level
10
-	Fire(*Entry) error
11
-}
12
-
13
-// Internal type for storing the hooks on a logger instance.
14
-type LevelHooks map[Level][]Hook
15
-
16
-// Add a hook to an instance of logger. This is called with
17
-// `log.Hooks.Add(new(MyHook))` where `MyHook` implements the `Hook` interface.
18
-func (hooks LevelHooks) Add(hook Hook) {
19
-	for _, level := range hook.Levels() {
20
-		hooks[level] = append(hooks[level], hook)
21
-	}
22
-}
23
-
24
-// Fire all the hooks for the passed level. Used by `entry.log` to fire
25
-// appropriate hooks for a log entry.
26
-func (hooks LevelHooks) Fire(level Level, entry *Entry) error {
27
-	for _, hook := range hooks[level] {
28
-		if err := hook.Fire(entry); err != nil {
29
-			return err
30
-		}
31
-	}
32
-
33
-	return nil
34
-}
35 1
deleted file mode 100644
... ...
@@ -1,41 +0,0 @@
1
-package logrus
2
-
3
-import (
4
-	"encoding/json"
5
-	"fmt"
6
-)
7
-
8
-type JSONFormatter struct {
9
-	// TimestampFormat sets the format used for marshaling timestamps.
10
-	TimestampFormat string
11
-}
12
-
13
-func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) {
14
-	data := make(Fields, len(entry.Data)+3)
15
-	for k, v := range entry.Data {
16
-		switch v := v.(type) {
17
-		case error:
18
-			// Otherwise errors are ignored by `encoding/json`
19
-			// https://github.com/Sirupsen/logrus/issues/137
20
-			data[k] = v.Error()
21
-		default:
22
-			data[k] = v
23
-		}
24
-	}
25
-	prefixFieldClashes(data)
26
-
27
-	timestampFormat := f.TimestampFormat
28
-	if timestampFormat == "" {
29
-		timestampFormat = DefaultTimestampFormat
30
-	}
31
-
32
-	data["time"] = entry.Time.Format(timestampFormat)
33
-	data["msg"] = entry.Message
34
-	data["level"] = entry.Level.String()
35
-
36
-	serialized, err := json.Marshal(data)
37
-	if err != nil {
38
-		return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err)
39
-	}
40
-	return append(serialized, '\n'), nil
41
-}
42 1
deleted file mode 100644
... ...
@@ -1,308 +0,0 @@
1
-package logrus
2
-
3
-import (
4
-	"io"
5
-	"os"
6
-	"sync"
7
-)
8
-
9
-type Logger struct {
10
-	// The logs are `io.Copy`'d to this in a mutex. It's common to set this to a
11
-	// file, or leave it default which is `os.Stderr`. You can also set this to
12
-	// something more adventorous, such as logging to Kafka.
13
-	Out io.Writer
14
-	// Hooks for the logger instance. These allow firing events based on logging
15
-	// levels and log entries. For example, to send errors to an error tracking
16
-	// service, log to StatsD or dump the core on fatal errors.
17
-	Hooks LevelHooks
18
-	// All log entries pass through the formatter before logged to Out. The
19
-	// included formatters are `TextFormatter` and `JSONFormatter` for which
20
-	// TextFormatter is the default. In development (when a TTY is attached) it
21
-	// logs with colors, but to a file it wouldn't. You can easily implement your
22
-	// own that implements the `Formatter` interface, see the `README` or included
23
-	// formatters for examples.
24
-	Formatter Formatter
25
-	// The logging level the logger should log at. This is typically (and defaults
26
-	// to) `logrus.Info`, which allows Info(), Warn(), Error() and Fatal() to be
27
-	// logged. `logrus.Debug` is useful in
28
-	Level Level
29
-	// Used to sync writing to the log. Locking is enabled by Default
30
-	mu MutexWrap
31
-	// Reusable empty entry
32
-	entryPool sync.Pool
33
-}
34
-
35
-type MutexWrap struct {
36
-	lock     sync.Mutex
37
-	disabled bool
38
-}
39
-
40
-func (mw *MutexWrap) Lock() {
41
-	if !mw.disabled {
42
-		mw.lock.Lock()
43
-	}
44
-}
45
-
46
-func (mw *MutexWrap) Unlock() {
47
-	if !mw.disabled {
48
-		mw.lock.Unlock()
49
-	}
50
-}
51
-
52
-func (mw *MutexWrap) Disable() {
53
-	mw.disabled = true
54
-}
55
-
56
-// Creates a new logger. Configuration should be set by changing `Formatter`,
57
-// `Out` and `Hooks` directly on the default logger instance. You can also just
58
-// instantiate your own:
59
-//
60
-//    var log = &Logger{
61
-//      Out: os.Stderr,
62
-//      Formatter: new(JSONFormatter),
63
-//      Hooks: make(LevelHooks),
64
-//      Level: logrus.DebugLevel,
65
-//    }
66
-//
67
-// It's recommended to make this a global instance called `log`.
68
-func New() *Logger {
69
-	return &Logger{
70
-		Out:       os.Stderr,
71
-		Formatter: new(TextFormatter),
72
-		Hooks:     make(LevelHooks),
73
-		Level:     InfoLevel,
74
-	}
75
-}
76
-
77
-func (logger *Logger) newEntry() *Entry {
78
-	entry, ok := logger.entryPool.Get().(*Entry)
79
-	if ok {
80
-		return entry
81
-	}
82
-	return NewEntry(logger)
83
-}
84
-
85
-func (logger *Logger) releaseEntry(entry *Entry) {
86
-	logger.entryPool.Put(entry)
87
-}
88
-
89
-// Adds a field to the log entry, note that it doesn't log until you call
90
-// Debug, Print, Info, Warn, Fatal or Panic. It only creates a log entry.
91
-// If you want multiple fields, use `WithFields`.
92
-func (logger *Logger) WithField(key string, value interface{}) *Entry {
93
-	entry := logger.newEntry()
94
-	defer logger.releaseEntry(entry)
95
-	return entry.WithField(key, value)
96
-}
97
-
98
-// Adds a struct of fields to the log entry. All it does is call `WithField` for
99
-// each `Field`.
100
-func (logger *Logger) WithFields(fields Fields) *Entry {
101
-	entry := logger.newEntry()
102
-	defer logger.releaseEntry(entry)
103
-	return entry.WithFields(fields)
104
-}
105
-
106
-// Add an error as single field to the log entry.  All it does is call
107
-// `WithError` for the given `error`.
108
-func (logger *Logger) WithError(err error) *Entry {
109
-	entry := logger.newEntry()
110
-	defer logger.releaseEntry(entry)
111
-	return entry.WithError(err)
112
-}
113
-
114
-func (logger *Logger) Debugf(format string, args ...interface{}) {
115
-	if logger.Level >= DebugLevel {
116
-		entry := logger.newEntry()
117
-		entry.Debugf(format, args...)
118
-		logger.releaseEntry(entry)
119
-	}
120
-}
121
-
122
-func (logger *Logger) Infof(format string, args ...interface{}) {
123
-	if logger.Level >= InfoLevel {
124
-		entry := logger.newEntry()
125
-		entry.Infof(format, args...)
126
-		logger.releaseEntry(entry)
127
-	}
128
-}
129
-
130
-func (logger *Logger) Printf(format string, args ...interface{}) {
131
-	entry := logger.newEntry()
132
-	entry.Printf(format, args...)
133
-	logger.releaseEntry(entry)
134
-}
135
-
136
-func (logger *Logger) Warnf(format string, args ...interface{}) {
137
-	if logger.Level >= WarnLevel {
138
-		entry := logger.newEntry()
139
-		entry.Warnf(format, args...)
140
-		logger.releaseEntry(entry)
141
-	}
142
-}
143
-
144
-func (logger *Logger) Warningf(format string, args ...interface{}) {
145
-	if logger.Level >= WarnLevel {
146
-		entry := logger.newEntry()
147
-		entry.Warnf(format, args...)
148
-		logger.releaseEntry(entry)
149
-	}
150
-}
151
-
152
-func (logger *Logger) Errorf(format string, args ...interface{}) {
153
-	if logger.Level >= ErrorLevel {
154
-		entry := logger.newEntry()
155
-		entry.Errorf(format, args...)
156
-		logger.releaseEntry(entry)
157
-	}
158
-}
159
-
160
-func (logger *Logger) Fatalf(format string, args ...interface{}) {
161
-	if logger.Level >= FatalLevel {
162
-		entry := logger.newEntry()
163
-		entry.Fatalf(format, args...)
164
-		logger.releaseEntry(entry)
165
-	}
166
-	Exit(1)
167
-}
168
-
169
-func (logger *Logger) Panicf(format string, args ...interface{}) {
170
-	if logger.Level >= PanicLevel {
171
-		entry := logger.newEntry()
172
-		entry.Panicf(format, args...)
173
-		logger.releaseEntry(entry)
174
-	}
175
-}
176
-
177
-func (logger *Logger) Debug(args ...interface{}) {
178
-	if logger.Level >= DebugLevel {
179
-		entry := logger.newEntry()
180
-		entry.Debug(args...)
181
-		logger.releaseEntry(entry)
182
-	}
183
-}
184
-
185
-func (logger *Logger) Info(args ...interface{}) {
186
-	if logger.Level >= InfoLevel {
187
-		entry := logger.newEntry()
188
-		entry.Info(args...)
189
-		logger.releaseEntry(entry)
190
-	}
191
-}
192
-
193
-func (logger *Logger) Print(args ...interface{}) {
194
-	entry := logger.newEntry()
195
-	entry.Info(args...)
196
-	logger.releaseEntry(entry)
197
-}
198
-
199
-func (logger *Logger) Warn(args ...interface{}) {
200
-	if logger.Level >= WarnLevel {
201
-		entry := logger.newEntry()
202
-		entry.Warn(args...)
203
-		logger.releaseEntry(entry)
204
-	}
205
-}
206
-
207
-func (logger *Logger) Warning(args ...interface{}) {
208
-	if logger.Level >= WarnLevel {
209
-		entry := logger.newEntry()
210
-		entry.Warn(args...)
211
-		logger.releaseEntry(entry)
212
-	}
213
-}
214
-
215
-func (logger *Logger) Error(args ...interface{}) {
216
-	if logger.Level >= ErrorLevel {
217
-		entry := logger.newEntry()
218
-		entry.Error(args...)
219
-		logger.releaseEntry(entry)
220
-	}
221
-}
222
-
223
-func (logger *Logger) Fatal(args ...interface{}) {
224
-	if logger.Level >= FatalLevel {
225
-		entry := logger.newEntry()
226
-		entry.Fatal(args...)
227
-		logger.releaseEntry(entry)
228
-	}
229
-	Exit(1)
230
-}
231
-
232
-func (logger *Logger) Panic(args ...interface{}) {
233
-	if logger.Level >= PanicLevel {
234
-		entry := logger.newEntry()
235
-		entry.Panic(args...)
236
-		logger.releaseEntry(entry)
237
-	}
238
-}
239
-
240
-func (logger *Logger) Debugln(args ...interface{}) {
241
-	if logger.Level >= DebugLevel {
242
-		entry := logger.newEntry()
243
-		entry.Debugln(args...)
244
-		logger.releaseEntry(entry)
245
-	}
246
-}
247
-
248
-func (logger *Logger) Infoln(args ...interface{}) {
249
-	if logger.Level >= InfoLevel {
250
-		entry := logger.newEntry()
251
-		entry.Infoln(args...)
252
-		logger.releaseEntry(entry)
253
-	}
254
-}
255
-
256
-func (logger *Logger) Println(args ...interface{}) {
257
-	entry := logger.newEntry()
258
-	entry.Println(args...)
259
-	logger.releaseEntry(entry)
260
-}
261
-
262
-func (logger *Logger) Warnln(args ...interface{}) {
263
-	if logger.Level >= WarnLevel {
264
-		entry := logger.newEntry()
265
-		entry.Warnln(args...)
266
-		logger.releaseEntry(entry)
267
-	}
268
-}
269
-
270
-func (logger *Logger) Warningln(args ...interface{}) {
271
-	if logger.Level >= WarnLevel {
272
-		entry := logger.newEntry()
273
-		entry.Warnln(args...)
274
-		logger.releaseEntry(entry)
275
-	}
276
-}
277
-
278
-func (logger *Logger) Errorln(args ...interface{}) {
279
-	if logger.Level >= ErrorLevel {
280
-		entry := logger.newEntry()
281
-		entry.Errorln(args...)
282
-		logger.releaseEntry(entry)
283
-	}
284
-}
285
-
286
-func (logger *Logger) Fatalln(args ...interface{}) {
287
-	if logger.Level >= FatalLevel {
288
-		entry := logger.newEntry()
289
-		entry.Fatalln(args...)
290
-		logger.releaseEntry(entry)
291
-	}
292
-	Exit(1)
293
-}
294
-
295
-func (logger *Logger) Panicln(args ...interface{}) {
296
-	if logger.Level >= PanicLevel {
297
-		entry := logger.newEntry()
298
-		entry.Panicln(args...)
299
-		logger.releaseEntry(entry)
300
-	}
301
-}
302
-
303
-//When file is opened with appending mode, it's safe to
304
-//write concurrently to a file (within 4k message on Linux).
305
-//In these cases user can choose to disable the lock.
306
-func (logger *Logger) SetNoLock() {
307
-	logger.mu.Disable()
308
-}
309 1
deleted file mode 100644
... ...
@@ -1,143 +0,0 @@
1
-package logrus
2
-
3
-import (
4
-	"fmt"
5
-	"log"
6
-	"strings"
7
-)
8
-
9
-// Fields type, used to pass to `WithFields`.
10
-type Fields map[string]interface{}
11
-
12
-// Level type
13
-type Level uint8
14
-
15
-// Convert the Level to a string. E.g. PanicLevel becomes "panic".
16
-func (level Level) String() string {
17
-	switch level {
18
-	case DebugLevel:
19
-		return "debug"
20
-	case InfoLevel:
21
-		return "info"
22
-	case WarnLevel:
23
-		return "warning"
24
-	case ErrorLevel:
25
-		return "error"
26
-	case FatalLevel:
27
-		return "fatal"
28
-	case PanicLevel:
29
-		return "panic"
30
-	}
31
-
32
-	return "unknown"
33
-}
34
-
35
-// ParseLevel takes a string level and returns the Logrus log level constant.
36
-func ParseLevel(lvl string) (Level, error) {
37
-	switch strings.ToLower(lvl) {
38
-	case "panic":
39
-		return PanicLevel, nil
40
-	case "fatal":
41
-		return FatalLevel, nil
42
-	case "error":
43
-		return ErrorLevel, nil
44
-	case "warn", "warning":
45
-		return WarnLevel, nil
46
-	case "info":
47
-		return InfoLevel, nil
48
-	case "debug":
49
-		return DebugLevel, nil
50
-	}
51
-
52
-	var l Level
53
-	return l, fmt.Errorf("not a valid logrus Level: %q", lvl)
54
-}
55
-
56
-// A constant exposing all logging levels
57
-var AllLevels = []Level{
58
-	PanicLevel,
59
-	FatalLevel,
60
-	ErrorLevel,
61
-	WarnLevel,
62
-	InfoLevel,
63
-	DebugLevel,
64
-}
65
-
66
-// These are the different logging levels. You can set the logging level to log
67
-// on your instance of logger, obtained with `logrus.New()`.
68
-const (
69
-	// PanicLevel level, highest level of severity. Logs and then calls panic with the
70
-	// message passed to Debug, Info, ...
71
-	PanicLevel Level = iota
72
-	// FatalLevel level. Logs and then calls `os.Exit(1)`. It will exit even if the
73
-	// logging level is set to Panic.
74
-	FatalLevel
75
-	// ErrorLevel level. Logs. Used for errors that should definitely be noted.
76
-	// Commonly used for hooks to send errors to an error tracking service.
77
-	ErrorLevel
78
-	// WarnLevel level. Non-critical entries that deserve eyes.
79
-	WarnLevel
80
-	// InfoLevel level. General operational entries about what's going on inside the
81
-	// application.
82
-	InfoLevel
83
-	// DebugLevel level. Usually only enabled when debugging. Very verbose logging.
84
-	DebugLevel
85
-)
86
-
87
-// Won't compile if StdLogger can't be realized by a log.Logger
88
-var (
89
-	_ StdLogger = &log.Logger{}
90
-	_ StdLogger = &Entry{}
91
-	_ StdLogger = &Logger{}
92
-)
93
-
94
-// StdLogger is what your logrus-enabled library should take, that way
95
-// it'll accept a stdlib logger and a logrus logger. There's no standard
96
-// interface, this is the closest we get, unfortunately.
97
-type StdLogger interface {
98
-	Print(...interface{})
99
-	Printf(string, ...interface{})
100
-	Println(...interface{})
101
-
102
-	Fatal(...interface{})
103
-	Fatalf(string, ...interface{})
104
-	Fatalln(...interface{})
105
-
106
-	Panic(...interface{})
107
-	Panicf(string, ...interface{})
108
-	Panicln(...interface{})
109
-}
110
-
111
-// The FieldLogger interface generalizes the Entry and Logger types
112
-type FieldLogger interface {
113
-	WithField(key string, value interface{}) *Entry
114
-	WithFields(fields Fields) *Entry
115
-	WithError(err error) *Entry
116
-
117
-	Debugf(format string, args ...interface{})
118
-	Infof(format string, args ...interface{})
119
-	Printf(format string, args ...interface{})
120
-	Warnf(format string, args ...interface{})
121
-	Warningf(format string, args ...interface{})
122
-	Errorf(format string, args ...interface{})
123
-	Fatalf(format string, args ...interface{})
124
-	Panicf(format string, args ...interface{})
125
-
126
-	Debug(args ...interface{})
127
-	Info(args ...interface{})
128
-	Print(args ...interface{})
129
-	Warn(args ...interface{})
130
-	Warning(args ...interface{})
131
-	Error(args ...interface{})
132
-	Fatal(args ...interface{})
133
-	Panic(args ...interface{})
134
-
135
-	Debugln(args ...interface{})
136
-	Infoln(args ...interface{})
137
-	Println(args ...interface{})
138
-	Warnln(args ...interface{})
139
-	Warningln(args ...interface{})
140
-	Errorln(args ...interface{})
141
-	Fatalln(args ...interface{})
142
-	Panicln(args ...interface{})
143
-}
144 1
deleted file mode 100644
... ...
@@ -1,8 +0,0 @@
1
-// +build appengine
2
-
3
-package logrus
4
-
5
-// IsTerminal returns true if stderr's file descriptor is a terminal.
6
-func IsTerminal() bool {
7
-	return true
8
-}
9 1
deleted file mode 100644
... ...
@@ -1,10 +0,0 @@
1
-// +build darwin freebsd openbsd netbsd dragonfly
2
-// +build !appengine
3
-
4
-package logrus
5
-
6
-import "syscall"
7
-
8
-const ioctlReadTermios = syscall.TIOCGETA
9
-
10
-type Termios syscall.Termios
11 1
deleted file mode 100644
... ...
@@ -1,14 +0,0 @@
1
-// Based on ssh/terminal:
2
-// Copyright 2013 The Go Authors. All rights reserved.
3
-// Use of this source code is governed by a BSD-style
4
-// license that can be found in the LICENSE file.
5
-
6
-// +build !appengine
7
-
8
-package logrus
9
-
10
-import "syscall"
11
-
12
-const ioctlReadTermios = syscall.TCGETS
13
-
14
-type Termios syscall.Termios
15 1
deleted file mode 100644
... ...
@@ -1,22 +0,0 @@
1
-// Based on ssh/terminal:
2
-// Copyright 2011 The Go Authors. All rights reserved.
3
-// Use of this source code is governed by a BSD-style
4
-// license that can be found in the LICENSE file.
5
-
6
-// +build linux darwin freebsd openbsd netbsd dragonfly
7
-// +build !appengine
8
-
9
-package logrus
10
-
11
-import (
12
-	"syscall"
13
-	"unsafe"
14
-)
15
-
16
-// IsTerminal returns true if stderr's file descriptor is a terminal.
17
-func IsTerminal() bool {
18
-	fd := syscall.Stderr
19
-	var termios Termios
20
-	_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(fd), ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
21
-	return err == 0
22
-}
23 1
deleted file mode 100644
... ...
@@ -1,15 +0,0 @@
1
-// +build solaris,!appengine
2
-
3
-package logrus
4
-
5
-import (
6
-	"os"
7
-
8
-	"golang.org/x/sys/unix"
9
-)
10
-
11
-// IsTerminal returns true if the given file descriptor is a terminal.
12
-func IsTerminal() bool {
13
-	_, err := unix.IoctlGetTermios(int(os.Stdout.Fd()), unix.TCGETA)
14
-	return err == nil
15
-}
16 1
deleted file mode 100644
... ...
@@ -1,27 +0,0 @@
1
-// Based on ssh/terminal:
2
-// Copyright 2011 The Go Authors. All rights reserved.
3
-// Use of this source code is governed by a BSD-style
4
-// license that can be found in the LICENSE file.
5
-
6
-// +build windows,!appengine
7
-
8
-package logrus
9
-
10
-import (
11
-	"syscall"
12
-	"unsafe"
13
-)
14
-
15
-var kernel32 = syscall.NewLazyDLL("kernel32.dll")
16
-
17
-var (
18
-	procGetConsoleMode = kernel32.NewProc("GetConsoleMode")
19
-)
20
-
21
-// IsTerminal returns true if stderr's file descriptor is a terminal.
22
-func IsTerminal() bool {
23
-	fd := syscall.Stderr
24
-	var st uint32
25
-	r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(fd), uintptr(unsafe.Pointer(&st)), 0)
26
-	return r != 0 && e == 0
27
-}
28 1
deleted file mode 100644
... ...
@@ -1,168 +0,0 @@
1
-package logrus
2
-
3
-import (
4
-	"bytes"
5
-	"fmt"
6
-	"runtime"
7
-	"sort"
8
-	"strings"
9
-	"time"
10
-)
11
-
12
-const (
13
-	nocolor = 0
14
-	red     = 31
15
-	green   = 32
16
-	yellow  = 33
17
-	blue    = 34
18
-	gray    = 37
19
-)
20
-
21
-var (
22
-	baseTimestamp time.Time
23
-	isTerminal    bool
24
-)
25
-
26
-func init() {
27
-	baseTimestamp = time.Now()
28
-	isTerminal = IsTerminal()
29
-}
30
-
31
-func miniTS() int {
32
-	return int(time.Since(baseTimestamp) / time.Second)
33
-}
34
-
35
-type TextFormatter struct {
36
-	// Set to true to bypass checking for a TTY before outputting colors.
37
-	ForceColors bool
38
-
39
-	// Force disabling colors.
40
-	DisableColors bool
41
-
42
-	// Disable timestamp logging. useful when output is redirected to logging
43
-	// system that already adds timestamps.
44
-	DisableTimestamp bool
45
-
46
-	// Enable logging the full timestamp when a TTY is attached instead of just
47
-	// the time passed since beginning of execution.
48
-	FullTimestamp bool
49
-
50
-	// TimestampFormat to use for display when a full timestamp is printed
51
-	TimestampFormat string
52
-
53
-	// The fields are sorted by default for a consistent output. For applications
54
-	// that log extremely frequently and don't use the JSON formatter this may not
55
-	// be desired.
56
-	DisableSorting bool
57
-}
58
-
59
-func (f *TextFormatter) Format(entry *Entry) ([]byte, error) {
60
-	var b *bytes.Buffer
61
-	var keys []string = make([]string, 0, len(entry.Data))
62
-	for k := range entry.Data {
63
-		keys = append(keys, k)
64
-	}
65
-
66
-	if !f.DisableSorting {
67
-		sort.Strings(keys)
68
-	}
69
-	if entry.Buffer != nil {
70
-		b = entry.Buffer
71
-	} else {
72
-		b = &bytes.Buffer{}
73
-	}
74
-
75
-	prefixFieldClashes(entry.Data)
76
-
77
-	isColorTerminal := isTerminal && (runtime.GOOS != "windows")
78
-	isColored := (f.ForceColors || isColorTerminal) && !f.DisableColors
79
-
80
-	timestampFormat := f.TimestampFormat
81
-	if timestampFormat == "" {
82
-		timestampFormat = DefaultTimestampFormat
83
-	}
84
-	if isColored {
85
-		f.printColored(b, entry, keys, timestampFormat)
86
-	} else {
87
-		if !f.DisableTimestamp {
88
-			f.appendKeyValue(b, "time", entry.Time.Format(timestampFormat))
89
-		}
90
-		f.appendKeyValue(b, "level", entry.Level.String())
91
-		if entry.Message != "" {
92
-			f.appendKeyValue(b, "msg", entry.Message)
93
-		}
94
-		for _, key := range keys {
95
-			f.appendKeyValue(b, key, entry.Data[key])
96
-		}
97
-	}
98
-
99
-	b.WriteByte('\n')
100
-	return b.Bytes(), nil
101
-}
102
-
103
-func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []string, timestampFormat string) {
104
-	var levelColor int
105
-	switch entry.Level {
106
-	case DebugLevel:
107
-		levelColor = gray
108
-	case WarnLevel:
109
-		levelColor = yellow
110
-	case ErrorLevel, FatalLevel, PanicLevel:
111
-		levelColor = red
112
-	default:
113
-		levelColor = blue
114
-	}
115
-
116
-	levelText := strings.ToUpper(entry.Level.String())[0:4]
117
-
118
-	if !f.FullTimestamp {
119
-		fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%04d] %-44s ", levelColor, levelText, miniTS(), entry.Message)
120
-	} else {
121
-		fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%s] %-44s ", levelColor, levelText, entry.Time.Format(timestampFormat), entry.Message)
122
-	}
123
-	for _, k := range keys {
124
-		v := entry.Data[k]
125
-		fmt.Fprintf(b, " \x1b[%dm%s\x1b[0m=", levelColor, k)
126
-		f.appendValue(b, v)
127
-	}
128
-}
129
-
130
-func needsQuoting(text string) bool {
131
-	for _, ch := range text {
132
-		if !((ch >= 'a' && ch <= 'z') ||
133
-			(ch >= 'A' && ch <= 'Z') ||
134
-			(ch >= '0' && ch <= '9') ||
135
-			ch == '-' || ch == '.') {
136
-			return true
137
-		}
138
-	}
139
-	return false
140
-}
141
-
142
-func (f *TextFormatter) appendKeyValue(b *bytes.Buffer, key string, value interface{}) {
143
-
144
-	b.WriteString(key)
145
-	b.WriteByte('=')
146
-	f.appendValue(b, value)
147
-	b.WriteByte(' ')
148
-}
149
-
150
-func (f *TextFormatter) appendValue(b *bytes.Buffer, value interface{}) {
151
-	switch value := value.(type) {
152
-	case string:
153
-		if !needsQuoting(value) {
154
-			b.WriteString(value)
155
-		} else {
156
-			fmt.Fprintf(b, "%q", value)
157
-		}
158
-	case error:
159
-		errmsg := value.Error()
160
-		if !needsQuoting(errmsg) {
161
-			b.WriteString(errmsg)
162
-		} else {
163
-			fmt.Fprintf(b, "%q", errmsg)
164
-		}
165
-	default:
166
-		fmt.Fprint(b, value)
167
-	}
168
-}
169 1
deleted file mode 100644
... ...
@@ -1,53 +0,0 @@
1
-package logrus
2
-
3
-import (
4
-	"bufio"
5
-	"io"
6
-	"runtime"
7
-)
8
-
9
-func (logger *Logger) Writer() *io.PipeWriter {
10
-	return logger.WriterLevel(InfoLevel)
11
-}
12
-
13
-func (logger *Logger) WriterLevel(level Level) *io.PipeWriter {
14
-	reader, writer := io.Pipe()
15
-
16
-	var printFunc func(args ...interface{})
17
-	switch level {
18
-	case DebugLevel:
19
-		printFunc = logger.Debug
20
-	case InfoLevel:
21
-		printFunc = logger.Info
22
-	case WarnLevel:
23
-		printFunc = logger.Warn
24
-	case ErrorLevel:
25
-		printFunc = logger.Error
26
-	case FatalLevel:
27
-		printFunc = logger.Fatal
28
-	case PanicLevel:
29
-		printFunc = logger.Panic
30
-	default:
31
-		printFunc = logger.Print
32
-	}
33
-
34
-	go logger.writerScanner(reader, printFunc)
35
-	runtime.SetFinalizer(writer, writerFinalizer)
36
-
37
-	return writer
38
-}
39
-
40
-func (logger *Logger) writerScanner(reader *io.PipeReader, printFunc func(args ...interface{})) {
41
-	scanner := bufio.NewScanner(reader)
42
-	for scanner.Scan() {
43
-		printFunc(scanner.Text())
44
-	}
45
-	if err := scanner.Err(); err != nil {
46
-		logger.Errorf("Error while reading from Writer: %s", err)
47
-	}
48
-	reader.Close()
49
-}
50
-
51
-func writerFinalizer(writer *io.PipeWriter) {
52
-	writer.Close()
53
-}
54 1
new file mode 100644
... ...
@@ -0,0 +1,21 @@
0
+The MIT License (MIT)
1
+
2
+Copyright (c) 2014 Simon Eskildsen
3
+
4
+Permission is hereby granted, free of charge, to any person obtaining a copy
5
+of this software and associated documentation files (the "Software"), to deal
6
+in the Software without restriction, including without limitation the rights
7
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+copies of the Software, and to permit persons to whom the Software is
9
+furnished to do so, subject to the following conditions:
10
+
11
+The above copyright notice and this permission notice shall be included in
12
+all copies or substantial portions of the Software.
13
+
14
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+THE SOFTWARE.
0 21
new file mode 100644
... ...
@@ -0,0 +1,504 @@
0
+# Logrus <img src="http://i.imgur.com/hTeVwmJ.png" width="40" height="40" alt=":walrus:" class="emoji" title=":walrus:"/>&nbsp;[![Build Status](https://travis-ci.org/sirupsen/logrus.svg?branch=master)](https://travis-ci.org/sirupsen/logrus)&nbsp;[![GoDoc](https://godoc.org/github.com/sirupsen/logrus?status.svg)](https://godoc.org/github.com/sirupsen/logrus)
1
+
2
+Logrus is a structured logger for Go (golang), completely API compatible with
3
+the standard library logger. [Godoc][godoc].
4
+
5
+**Seeing weird case-sensitive problems?** It's in the past been possible to
6
+import Logrus as both upper- and lower-case. Due to the Go package environment,
7
+this caused issues in the community and we needed a standard. Some environments
8
+experienced problems with the upper-case variant, so the lower-case was decided.
9
+Everything using `logrus` will need to use the lower-case:
10
+`github.com/sirupsen/logrus`. Any package that isn't, should be changed.
11
+
12
+To fix Glide, see [these
13
+comments](https://github.com/sirupsen/logrus/issues/553#issuecomment-306591437).
14
+For an in-depth explanation of the casing issue, see [this
15
+comment](https://github.com/sirupsen/logrus/issues/570#issuecomment-313933276).
16
+
17
+**Are you interested in assisting in maintaining Logrus?** Currently I have a
18
+lot of obligations, and I am unable to provide Logrus with the maintainership it
19
+needs. If you'd like to help, please reach out to me at `simon at author's
20
+username dot com`.
21
+
22
+Nicely color-coded in development (when a TTY is attached, otherwise just
23
+plain text):
24
+
25
+![Colored](http://i.imgur.com/PY7qMwd.png)
26
+
27
+With `log.SetFormatter(&log.JSONFormatter{})`, for easy parsing by logstash
28
+or Splunk:
29
+
30
+```json
31
+{"animal":"walrus","level":"info","msg":"A group of walrus emerges from the
32
+ocean","size":10,"time":"2014-03-10 19:57:38.562264131 -0400 EDT"}
33
+
34
+{"level":"warning","msg":"The group's number increased tremendously!",
35
+"number":122,"omg":true,"time":"2014-03-10 19:57:38.562471297 -0400 EDT"}
36
+
37
+{"animal":"walrus","level":"info","msg":"A giant walrus appears!",
38
+"size":10,"time":"2014-03-10 19:57:38.562500591 -0400 EDT"}
39
+
40
+{"animal":"walrus","level":"info","msg":"Tremendously sized cow enters the ocean.",
41
+"size":9,"time":"2014-03-10 19:57:38.562527896 -0400 EDT"}
42
+
43
+{"level":"fatal","msg":"The ice breaks!","number":100,"omg":true,
44
+"time":"2014-03-10 19:57:38.562543128 -0400 EDT"}
45
+```
46
+
47
+With the default `log.SetFormatter(&log.TextFormatter{})` when a TTY is not
48
+attached, the output is compatible with the
49
+[logfmt](http://godoc.org/github.com/kr/logfmt) format:
50
+
51
+```text
52
+time="2015-03-26T01:27:38-04:00" level=debug msg="Started observing beach" animal=walrus number=8
53
+time="2015-03-26T01:27:38-04:00" level=info msg="A group of walrus emerges from the ocean" animal=walrus size=10
54
+time="2015-03-26T01:27:38-04:00" level=warning msg="The group's number increased tremendously!" number=122 omg=true
55
+time="2015-03-26T01:27:38-04:00" level=debug msg="Temperature changes" temperature=-4
56
+time="2015-03-26T01:27:38-04:00" level=panic msg="It's over 9000!" animal=orca size=9009
57
+time="2015-03-26T01:27:38-04:00" level=fatal msg="The ice breaks!" err=&{0x2082280c0 map[animal:orca size:9009] 2015-03-26 01:27:38.441574009 -0400 EDT panic It's over 9000!} number=100 omg=true
58
+exit status 1
59
+```
60
+
61
+#### Case-sensitivity
62
+
63
+The organization's name was changed to lower-case--and this will not be changed
64
+back. If you are getting import conflicts due to case sensitivity, please use
65
+the lower-case import: `github.com/sirupsen/logrus`.
66
+
67
+#### Example
68
+
69
+The simplest way to use Logrus is simply the package-level exported logger:
70
+
71
+```go
72
+package main
73
+
74
+import (
75
+  log "github.com/sirupsen/logrus"
76
+)
77
+
78
+func main() {
79
+  log.WithFields(log.Fields{
80
+    "animal": "walrus",
81
+  }).Info("A walrus appears")
82
+}
83
+```
84
+
85
+Note that it's completely api-compatible with the stdlib logger, so you can
86
+replace your `log` imports everywhere with `log "github.com/sirupsen/logrus"`
87
+and you'll now have the flexibility of Logrus. You can customize it all you
88
+want:
89
+
90
+```go
91
+package main
92
+
93
+import (
94
+  "os"
95
+  log "github.com/sirupsen/logrus"
96
+)
97
+
98
+func init() {
99
+  // Log as JSON instead of the default ASCII formatter.
100
+  log.SetFormatter(&log.JSONFormatter{})
101
+
102
+  // Output to stdout instead of the default stderr
103
+  // Can be any io.Writer, see below for File example
104
+  log.SetOutput(os.Stdout)
105
+
106
+  // Only log the warning severity or above.
107
+  log.SetLevel(log.WarnLevel)
108
+}
109
+
110
+func main() {
111
+  log.WithFields(log.Fields{
112
+    "animal": "walrus",
113
+    "size":   10,
114
+  }).Info("A group of walrus emerges from the ocean")
115
+
116
+  log.WithFields(log.Fields{
117
+    "omg":    true,
118
+    "number": 122,
119
+  }).Warn("The group's number increased tremendously!")
120
+
121
+  log.WithFields(log.Fields{
122
+    "omg":    true,
123
+    "number": 100,
124
+  }).Fatal("The ice breaks!")
125
+
126
+  // A common pattern is to re-use fields between logging statements by re-using
127
+  // the logrus.Entry returned from WithFields()
128
+  contextLogger := log.WithFields(log.Fields{
129
+    "common": "this is a common field",
130
+    "other": "I also should be logged always",
131
+  })
132
+
133
+  contextLogger.Info("I'll be logged with common and other field")
134
+  contextLogger.Info("Me too")
135
+}
136
+```
137
+
138
+For more advanced usage such as logging to multiple locations from the same
139
+application, you can also create an instance of the `logrus` Logger:
140
+
141
+```go
142
+package main
143
+
144
+import (
145
+  "os"
146
+  "github.com/sirupsen/logrus"
147
+)
148
+
149
+// Create a new instance of the logger. You can have any number of instances.
150
+var log = logrus.New()
151
+
152
+func main() {
153
+  // The API for setting attributes is a little different than the package level
154
+  // exported logger. See Godoc.
155
+  log.Out = os.Stdout
156
+
157
+  // You could set this to any `io.Writer` such as a file
158
+  // file, err := os.OpenFile("logrus.log", os.O_CREATE|os.O_WRONLY, 0666)
159
+  // if err == nil {
160
+  //  log.Out = file
161
+  // } else {
162
+  //  log.Info("Failed to log to file, using default stderr")
163
+  // }
164
+
165
+  log.WithFields(logrus.Fields{
166
+    "animal": "walrus",
167
+    "size":   10,
168
+  }).Info("A group of walrus emerges from the ocean")
169
+}
170
+```
171
+
172
+#### Fields
173
+
174
+Logrus encourages careful, structured logging through logging fields instead of
175
+long, unparseable error messages. For example, instead of: `log.Fatalf("Failed
176
+to send event %s to topic %s with key %d")`, you should log the much more
177
+discoverable:
178
+
179
+```go
180
+log.WithFields(log.Fields{
181
+  "event": event,
182
+  "topic": topic,
183
+  "key": key,
184
+}).Fatal("Failed to send event")
185
+```
186
+
187
+We've found this API forces you to think about logging in a way that produces
188
+much more useful logging messages. We've been in countless situations where just
189
+a single added field to a log statement that was already there would've saved us
190
+hours. The `WithFields` call is optional.
191
+
192
+In general, with Logrus using any of the `printf`-family functions should be
193
+seen as a hint you should add a field, however, you can still use the
194
+`printf`-family functions with Logrus.
195
+
196
+#### Default Fields
197
+
198
+Often it's helpful to have fields _always_ attached to log statements in an
199
+application or parts of one. For example, you may want to always log the
200
+`request_id` and `user_ip` in the context of a request. Instead of writing
201
+`log.WithFields(log.Fields{"request_id": request_id, "user_ip": user_ip})` on
202
+every line, you can create a `logrus.Entry` to pass around instead:
203
+
204
+```go
205
+requestLogger := log.WithFields(log.Fields{"request_id": request_id, "user_ip": user_ip})
206
+requestLogger.Info("something happened on that request") # will log request_id and user_ip
207
+requestLogger.Warn("something not great happened")
208
+```
209
+
210
+#### Hooks
211
+
212
+You can add hooks for logging levels. For example to send errors to an exception
213
+tracking service on `Error`, `Fatal` and `Panic`, info to StatsD or log to
214
+multiple places simultaneously, e.g. syslog.
215
+
216
+Logrus comes with [built-in hooks](hooks/). Add those, or your custom hook, in
217
+`init`:
218
+
219
+```go
220
+import (
221
+  log "github.com/sirupsen/logrus"
222
+  "gopkg.in/gemnasium/logrus-airbrake-hook.v2" // the package is named "aibrake"
223
+  logrus_syslog "github.com/sirupsen/logrus/hooks/syslog"
224
+  "log/syslog"
225
+)
226
+
227
+func init() {
228
+
229
+  // Use the Airbrake hook to report errors that have Error severity or above to
230
+  // an exception tracker. You can create custom hooks, see the Hooks section.
231
+  log.AddHook(airbrake.NewHook(123, "xyz", "production"))
232
+
233
+  hook, err := logrus_syslog.NewSyslogHook("udp", "localhost:514", syslog.LOG_INFO, "")
234
+  if err != nil {
235
+    log.Error("Unable to connect to local syslog daemon")
236
+  } else {
237
+    log.AddHook(hook)
238
+  }
239
+}
240
+```
241
+Note: Syslog hook also support connecting to local syslog (Ex. "/dev/log" or "/var/run/syslog" or "/var/run/log"). For the detail, please check the [syslog hook README](hooks/syslog/README.md).
242
+
243
+| Hook  | Description |
244
+| ----- | ----------- |
245
+| [Airbrake "legacy"](https://github.com/gemnasium/logrus-airbrake-legacy-hook) | Send errors to an exception tracking service compatible with the Airbrake API V2. Uses [`airbrake-go`](https://github.com/tobi/airbrake-go) behind the scenes. |
246
+| [Airbrake](https://github.com/gemnasium/logrus-airbrake-hook) | Send errors to the Airbrake API V3. Uses the official [`gobrake`](https://github.com/airbrake/gobrake) behind the scenes. |
247
+| [Amazon Kinesis](https://github.com/evalphobia/logrus_kinesis) | Hook for logging to [Amazon Kinesis](https://aws.amazon.com/kinesis/) |
248
+| [Amqp-Hook](https://github.com/vladoatanasov/logrus_amqp) | Hook for logging to Amqp broker (Like RabbitMQ) |
249
+| [Bugsnag](https://github.com/Shopify/logrus-bugsnag/blob/master/bugsnag.go) | Send errors to the Bugsnag exception tracking service. |
250
+| [DeferPanic](https://github.com/deferpanic/dp-logrus) | Hook for logging to DeferPanic |
251
+| [Discordrus](https://github.com/kz/discordrus) | Hook for logging to [Discord](https://discordapp.com/) |
252
+| [ElasticSearch](https://github.com/sohlich/elogrus) | Hook for logging to ElasticSearch|
253
+| [Firehose](https://github.com/beaubrewer/logrus_firehose) | Hook for logging to [Amazon Firehose](https://aws.amazon.com/kinesis/firehose/)
254
+| [Fluentd](https://github.com/evalphobia/logrus_fluent) | Hook for logging to fluentd |
255
+| [Go-Slack](https://github.com/multiplay/go-slack) | Hook for logging to [Slack](https://slack.com) |
256
+| [Graylog](https://github.com/gemnasium/logrus-graylog-hook) | Hook for logging to [Graylog](http://graylog2.org/) |
257
+| [Hiprus](https://github.com/nubo/hiprus) | Send errors to a channel in hipchat. |
258
+| [Honeybadger](https://github.com/agonzalezro/logrus_honeybadger) | Hook for sending exceptions to Honeybadger |
259
+| [InfluxDB](https://github.com/Abramovic/logrus_influxdb) | Hook for logging to influxdb |
260
+| [Influxus](http://github.com/vlad-doru/influxus) | Hook for concurrently logging to [InfluxDB](http://influxdata.com/) |
261
+| [Journalhook](https://github.com/wercker/journalhook) | Hook for logging to `systemd-journald` |
262
+| [KafkaLogrus](https://github.com/goibibo/KafkaLogrus) | Hook for logging to kafka |
263
+| [LFShook](https://github.com/rifflock/lfshook) | Hook for logging to the local filesystem |
264
+| [Logentries](https://github.com/jcftang/logentriesrus) | Hook for logging to [Logentries](https://logentries.com/) |
265
+| [Logentrus](https://github.com/puddingfactory/logentrus) | Hook for logging to [Logentries](https://logentries.com/) |
266
+| [Logmatic.io](https://github.com/logmatic/logmatic-go) | Hook for logging to [Logmatic.io](http://logmatic.io/) |
267
+| [Logrusly](https://github.com/sebest/logrusly) | Send logs to [Loggly](https://www.loggly.com/) |
268
+| [Logstash](https://github.com/bshuster-repo/logrus-logstash-hook) | Hook for logging to [Logstash](https://www.elastic.co/products/logstash) |
269
+| [Mail](https://github.com/zbindenren/logrus_mail) | Hook for sending exceptions via mail |
270
+| [Mattermost](https://github.com/shuLhan/mattermost-integration/tree/master/hooks/logrus) | Hook for logging to [Mattermost](https://mattermost.com/) |
271
+| [Mongodb](https://github.com/weekface/mgorus) | Hook for logging to mongodb |
272
+| [NATS-Hook](https://github.com/rybit/nats_logrus_hook) | Hook for logging to [NATS](https://nats.io) |
273
+| [Octokit](https://github.com/dorajistyle/logrus-octokit-hook) | Hook for logging to github via octokit |
274
+| [Papertrail](https://github.com/polds/logrus-papertrail-hook) | Send errors to the [Papertrail](https://papertrailapp.com) hosted logging service via UDP. |
275
+| [PostgreSQL](https://github.com/gemnasium/logrus-postgresql-hook) | Send logs to [PostgreSQL](http://postgresql.org) |
276
+| [Pushover](https://github.com/toorop/logrus_pushover) | Send error via [Pushover](https://pushover.net) |
277
+| [Raygun](https://github.com/squirkle/logrus-raygun-hook) | Hook for logging to [Raygun.io](http://raygun.io/) |
278
+| [Redis-Hook](https://github.com/rogierlommers/logrus-redis-hook) | Hook for logging to a ELK stack (through Redis) |
279
+| [Rollrus](https://github.com/heroku/rollrus) | Hook for sending errors to rollbar |
280
+| [Scribe](https://github.com/sagar8192/logrus-scribe-hook) | Hook for logging to [Scribe](https://github.com/facebookarchive/scribe)|
281
+| [Sentry](https://github.com/evalphobia/logrus_sentry) | Send errors to the Sentry error logging and aggregation service. |
282
+| [Slackrus](https://github.com/johntdyer/slackrus) | Hook for Slack chat. |
283
+| [Stackdriver](https://github.com/knq/sdhook) | Hook for logging to [Google Stackdriver](https://cloud.google.com/logging/) |
284
+| [Sumorus](https://github.com/doublefree/sumorus) | Hook for logging to [SumoLogic](https://www.sumologic.com/)|
285
+| [Syslog](https://github.com/sirupsen/logrus/blob/master/hooks/syslog/syslog.go) | Send errors to remote syslog server. Uses standard library `log/syslog` behind the scenes. |
286
+| [Syslog TLS](https://github.com/shinji62/logrus-syslog-ng) | Send errors to remote syslog server with TLS support. |
287
+| [TraceView](https://github.com/evalphobia/logrus_appneta) | Hook for logging to [AppNeta TraceView](https://www.appneta.com/products/traceview/) |
288
+| [Typetalk](https://github.com/dragon3/logrus-typetalk-hook) | Hook for logging to [Typetalk](https://www.typetalk.in/) |
289
+| [logz.io](https://github.com/ripcurld00d/logrus-logzio-hook) | Hook for logging to [logz.io](https://logz.io), a Log as a Service using Logstash |
290
+| [SQS-Hook](https://github.com/tsarpaul/logrus_sqs) | Hook for logging to [Amazon Simple Queue Service (SQS)](https://aws.amazon.com/sqs/) |
291
+
292
+#### Level logging
293
+
294
+Logrus has six logging levels: Debug, Info, Warning, Error, Fatal and Panic.
295
+
296
+```go
297
+log.Debug("Useful debugging information.")
298
+log.Info("Something noteworthy happened!")
299
+log.Warn("You should probably take a look at this.")
300
+log.Error("Something failed but I'm not quitting.")
301
+// Calls os.Exit(1) after logging
302
+log.Fatal("Bye.")
303
+// Calls panic() after logging
304
+log.Panic("I'm bailing.")
305
+```
306
+
307
+You can set the logging level on a `Logger`, then it will only log entries with
308
+that severity or anything above it:
309
+
310
+```go
311
+// Will log anything that is info or above (warn, error, fatal, panic). Default.
312
+log.SetLevel(log.InfoLevel)
313
+```
314
+
315
+It may be useful to set `log.Level = logrus.DebugLevel` in a debug or verbose
316
+environment if your application has that.
317
+
318
+#### Entries
319
+
320
+Besides the fields added with `WithField` or `WithFields` some fields are
321
+automatically added to all logging events:
322
+
323
+1. `time`. The timestamp when the entry was created.
324
+2. `msg`. The logging message passed to `{Info,Warn,Error,Fatal,Panic}` after
325
+   the `AddFields` call. E.g. `Failed to send event.`
326
+3. `level`. The logging level. E.g. `info`.
327
+
328
+#### Environments
329
+
330
+Logrus has no notion of environment.
331
+
332
+If you wish for hooks and formatters to only be used in specific environments,
333
+you should handle that yourself. For example, if your application has a global
334
+variable `Environment`, which is a string representation of the environment you
335
+could do:
336
+
337
+```go
338
+import (
339
+  log "github.com/sirupsen/logrus"
340
+)
341
+
342
+init() {
343
+  // do something here to set environment depending on an environment variable
344
+  // or command-line flag
345
+  if Environment == "production" {
346
+    log.SetFormatter(&log.JSONFormatter{})
347
+  } else {
348
+    // The TextFormatter is default, you don't actually have to do this.
349
+    log.SetFormatter(&log.TextFormatter{})
350
+  }
351
+}
352
+```
353
+
354
+This configuration is how `logrus` was intended to be used, but JSON in
355
+production is mostly only useful if you do log aggregation with tools like
356
+Splunk or Logstash.
357
+
358
+#### Formatters
359
+
360
+The built-in logging formatters are:
361
+
362
+* `logrus.TextFormatter`. Logs the event in colors if stdout is a tty, otherwise
363
+  without colors.
364
+  * *Note:* to force colored output when there is no TTY, set the `ForceColors`
365
+    field to `true`.  To force no colored output even if there is a TTY  set the
366
+    `DisableColors` field to `true`. For Windows, see
367
+    [github.com/mattn/go-colorable](https://github.com/mattn/go-colorable).
368
+  * All options are listed in the [generated docs](https://godoc.org/github.com/sirupsen/logrus#TextFormatter).
369
+* `logrus.JSONFormatter`. Logs fields as JSON.
370
+  * All options are listed in the [generated docs](https://godoc.org/github.com/sirupsen/logrus#JSONFormatter).
371
+
372
+Third party logging formatters:
373
+
374
+* [`logstash`](https://github.com/bshuster-repo/logrus-logstash-hook). Logs fields as [Logstash](http://logstash.net) Events.
375
+* [`prefixed`](https://github.com/x-cray/logrus-prefixed-formatter). Displays log entry source along with alternative layout.
376
+* [`zalgo`](https://github.com/aybabtme/logzalgo). Invoking the P͉̫o̳̼̊w̖͈̰͎e̬͔̭͂r͚̼̹̲ ̫͓͉̳͈ō̠͕͖̚f̝͍̠ ͕̲̞͖͑Z̖̫̤̫ͪa͉̬͈̗l͖͎g̳̥o̰̥̅!̣͔̲̻͊̄ ̙̘̦̹̦.
377
+
378
+You can define your formatter by implementing the `Formatter` interface,
379
+requiring a `Format` method. `Format` takes an `*Entry`. `entry.Data` is a
380
+`Fields` type (`map[string]interface{}`) with all your fields as well as the
381
+default ones (see Entries section above):
382
+
383
+```go
384
+type MyJSONFormatter struct {
385
+}
386
+
387
+log.SetFormatter(new(MyJSONFormatter))
388
+
389
+func (f *MyJSONFormatter) Format(entry *Entry) ([]byte, error) {
390
+  // Note this doesn't include Time, Level and Message which are available on
391
+  // the Entry. Consult `godoc` on information about those fields or read the
392
+  // source of the official loggers.
393
+  serialized, err := json.Marshal(entry.Data)
394
+    if err != nil {
395
+      return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err)
396
+    }
397
+  return append(serialized, '\n'), nil
398
+}
399
+```
400
+
401
+#### Logger as an `io.Writer`
402
+
403
+Logrus can be transformed into an `io.Writer`. That writer is the end of an `io.Pipe` and it is your responsibility to close it.
404
+
405
+```go
406
+w := logger.Writer()
407
+defer w.Close()
408
+
409
+srv := http.Server{
410
+    // create a stdlib log.Logger that writes to
411
+    // logrus.Logger.
412
+    ErrorLog: log.New(w, "", 0),
413
+}
414
+```
415
+
416
+Each line written to that writer will be printed the usual way, using formatters
417
+and hooks. The level for those entries is `info`.
418
+
419
+This means that we can override the standard library logger easily:
420
+
421
+```go
422
+logger := logrus.New()
423
+logger.Formatter = &logrus.JSONFormatter{}
424
+
425
+// Use logrus for standard log output
426
+// Note that `log` here references stdlib's log
427
+// Not logrus imported under the name `log`.
428
+log.SetOutput(logger.Writer())
429
+```
430
+
431
+#### Rotation
432
+
433
+Log rotation is not provided with Logrus. Log rotation should be done by an
434
+external program (like `logrotate(8)`) that can compress and delete old log
435
+entries. It should not be a feature of the application-level logger.
436
+
437
+#### Tools
438
+
439
+| Tool | Description |
440
+| ---- | ----------- |
441
+|[Logrus Mate](https://github.com/gogap/logrus_mate)|Logrus mate is a tool for Logrus to manage loggers, you can initial logger's level, hook and formatter by config file, the logger will generated with different config at different environment.|
442
+|[Logrus Viper Helper](https://github.com/heirko/go-contrib/tree/master/logrusHelper)|An Helper around Logrus to wrap with spf13/Viper to load configuration with fangs! And to simplify Logrus configuration use some behavior of [Logrus Mate](https://github.com/gogap/logrus_mate). [sample](https://github.com/heirko/iris-contrib/blob/master/middleware/logrus-logger/example) |
443
+
444
+#### Testing
445
+
446
+Logrus has a built in facility for asserting the presence of log messages. This is implemented through the `test` hook and provides:
447
+
448
+* decorators for existing logger (`test.NewLocal` and `test.NewGlobal`) which basically just add the `test` hook
449
+* a test logger (`test.NewNullLogger`) that just records log messages (and does not output any):
450
+
451
+```go
452
+import(
453
+  "github.com/sirupsen/logrus"
454
+  "github.com/sirupsen/logrus/hooks/test"
455
+  "github.com/stretchr/testify/assert"
456
+  "testing"
457
+)
458
+
459
+func TestSomething(t*testing.T){
460
+  logger, hook := test.NewNullLogger()
461
+  logger.Error("Helloerror")
462
+
463
+  assert.Equal(t, 1, len(hook.Entries))
464
+  assert.Equal(t, logrus.ErrorLevel, hook.LastEntry().Level)
465
+  assert.Equal(t, "Helloerror", hook.LastEntry().Message)
466
+
467
+  hook.Reset()
468
+  assert.Nil(t, hook.LastEntry())
469
+}
470
+```
471
+
472
+#### Fatal handlers
473
+
474
+Logrus can register one or more functions that will be called when any `fatal`
475
+level message is logged. The registered handlers will be executed before
476
+logrus performs a `os.Exit(1)`. This behavior may be helpful if callers need
477
+to gracefully shutdown. Unlike a `panic("Something went wrong...")` call which can be intercepted with a deferred `recover` a call to `os.Exit(1)` can not be intercepted.
478
+
479
+```
480
+...
481
+handler := func() {
482
+  // gracefully shutdown something...
483
+}
484
+logrus.RegisterExitHandler(handler)
485
+...
486
+```
487
+
488
+#### Thread safety
489
+
490
+By default Logger is protected by mutex for concurrent writes, this mutex is invoked when calling hooks and writing logs.
491
+If you are sure such locking is not needed, you can call logger.SetNoLock() to disable the locking.
492
+
493
+Situation when locking is not needed includes:
494
+
495
+* You have no hooks registered, or hooks calling is already thread-safe.
496
+
497
+* Writing to logger.Out is already thread-safe, for example:
498
+
499
+  1) logger.Out is protected by locks.
500
+
501
+  2) logger.Out is a os.File handler opened with `O_APPEND` flag, and every write is smaller than 4k. (This allow multi-thread/multi-process writing)
502
+
503
+     (Refer to http://www.notthewizard.com/2014/06/17/are-files-appends-really-atomic/)
0 504
new file mode 100644
... ...
@@ -0,0 +1,64 @@
0
+package logrus
1
+
2
+// The following code was sourced and modified from the
3
+// https://github.com/tebeka/atexit package governed by the following license:
4
+//
5
+// Copyright (c) 2012 Miki Tebeka <miki.tebeka@gmail.com>.
6
+//
7
+// Permission is hereby granted, free of charge, to any person obtaining a copy of
8
+// this software and associated documentation files (the "Software"), to deal in
9
+// the Software without restriction, including without limitation the rights to
10
+// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11
+// the Software, and to permit persons to whom the Software is furnished to do so,
12
+// subject to the following conditions:
13
+//
14
+// The above copyright notice and this permission notice shall be included in all
15
+// copies or substantial portions of the Software.
16
+//
17
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19
+// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20
+// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21
+// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22
+// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+import (
25
+	"fmt"
26
+	"os"
27
+)
28
+
29
+var handlers = []func(){}
30
+
31
+func runHandler(handler func()) {
32
+	defer func() {
33
+		if err := recover(); err != nil {
34
+			fmt.Fprintln(os.Stderr, "Error: Logrus exit handler error:", err)
35
+		}
36
+	}()
37
+
38
+	handler()
39
+}
40
+
41
+func runHandlers() {
42
+	for _, handler := range handlers {
43
+		runHandler(handler)
44
+	}
45
+}
46
+
47
+// Exit runs all the Logrus atexit handlers and then terminates the program using os.Exit(code)
48
+func Exit(code int) {
49
+	runHandlers()
50
+	os.Exit(code)
51
+}
52
+
53
+// RegisterExitHandler adds a Logrus Exit handler, call logrus.Exit to invoke
54
+// all handlers. The handlers will also be invoked when any Fatal log entry is
55
+// made.
56
+//
57
+// This method is useful when a caller wishes to use logrus to log a fatal
58
+// message but also needs to gracefully shutdown. An example usecase could be
59
+// closing database connections, or sending a alert that the application is
60
+// closing.
61
+func RegisterExitHandler(handler func()) {
62
+	handlers = append(handlers, handler)
63
+}
0 64
new file mode 100644
... ...
@@ -0,0 +1,26 @@
0
+/*
1
+Package logrus is a structured logger for Go, completely API compatible with the standard library logger.
2
+
3
+
4
+The simplest way to use Logrus is simply the package-level exported logger:
5
+
6
+  package main
7
+
8
+  import (
9
+    log "github.com/sirupsen/logrus"
10
+  )
11
+
12
+  func main() {
13
+    log.WithFields(log.Fields{
14
+      "animal": "walrus",
15
+      "number": 1,
16
+      "size":   10,
17
+    }).Info("A walrus appears")
18
+  }
19
+
20
+Output:
21
+  time="2015-09-07T08:48:33Z" level=info msg="A walrus appears" animal=walrus number=1 size=10
22
+
23
+For a full guide visit https://github.com/sirupsen/logrus
24
+*/
25
+package logrus
0 26
new file mode 100644
... ...
@@ -0,0 +1,275 @@
0
+package logrus
1
+
2
+import (
3
+	"bytes"
4
+	"fmt"
5
+	"os"
6
+	"sync"
7
+	"time"
8
+)
9
+
10
+var bufferPool *sync.Pool
11
+
12
+func init() {
13
+	bufferPool = &sync.Pool{
14
+		New: func() interface{} {
15
+			return new(bytes.Buffer)
16
+		},
17
+	}
18
+}
19
+
20
+// Defines the key when adding errors using WithError.
21
+var ErrorKey = "error"
22
+
23
+// An entry is the final or intermediate Logrus logging entry. It contains all
24
+// the fields passed with WithField{,s}. It's finally logged when Debug, Info,
25
+// Warn, Error, Fatal or Panic is called on it. These objects can be reused and
26
+// passed around as much as you wish to avoid field duplication.
27
+type Entry struct {
28
+	Logger *Logger
29
+
30
+	// Contains all the fields set by the user.
31
+	Data Fields
32
+
33
+	// Time at which the log entry was created
34
+	Time time.Time
35
+
36
+	// Level the log entry was logged at: Debug, Info, Warn, Error, Fatal or Panic
37
+	Level Level
38
+
39
+	// Message passed to Debug, Info, Warn, Error, Fatal or Panic
40
+	Message string
41
+
42
+	// When formatter is called in entry.log(), an Buffer may be set to entry
43
+	Buffer *bytes.Buffer
44
+}
45
+
46
+func NewEntry(logger *Logger) *Entry {
47
+	return &Entry{
48
+		Logger: logger,
49
+		// Default is three fields, give a little extra room
50
+		Data: make(Fields, 5),
51
+	}
52
+}
53
+
54
+// Returns the string representation from the reader and ultimately the
55
+// formatter.
56
+func (entry *Entry) String() (string, error) {
57
+	serialized, err := entry.Logger.Formatter.Format(entry)
58
+	if err != nil {
59
+		return "", err
60
+	}
61
+	str := string(serialized)
62
+	return str, nil
63
+}
64
+
65
+// Add an error as single field (using the key defined in ErrorKey) to the Entry.
66
+func (entry *Entry) WithError(err error) *Entry {
67
+	return entry.WithField(ErrorKey, err)
68
+}
69
+
70
+// Add a single field to the Entry.
71
+func (entry *Entry) WithField(key string, value interface{}) *Entry {
72
+	return entry.WithFields(Fields{key: value})
73
+}
74
+
75
+// Add a map of fields to the Entry.
76
+func (entry *Entry) WithFields(fields Fields) *Entry {
77
+	data := make(Fields, len(entry.Data)+len(fields))
78
+	for k, v := range entry.Data {
79
+		data[k] = v
80
+	}
81
+	for k, v := range fields {
82
+		data[k] = v
83
+	}
84
+	return &Entry{Logger: entry.Logger, Data: data}
85
+}
86
+
87
+// This function is not declared with a pointer value because otherwise
88
+// race conditions will occur when using multiple goroutines
89
+func (entry Entry) log(level Level, msg string) {
90
+	var buffer *bytes.Buffer
91
+	entry.Time = time.Now()
92
+	entry.Level = level
93
+	entry.Message = msg
94
+
95
+	if err := entry.Logger.Hooks.Fire(level, &entry); err != nil {
96
+		entry.Logger.mu.Lock()
97
+		fmt.Fprintf(os.Stderr, "Failed to fire hook: %v\n", err)
98
+		entry.Logger.mu.Unlock()
99
+	}
100
+	buffer = bufferPool.Get().(*bytes.Buffer)
101
+	buffer.Reset()
102
+	defer bufferPool.Put(buffer)
103
+	entry.Buffer = buffer
104
+	serialized, err := entry.Logger.Formatter.Format(&entry)
105
+	entry.Buffer = nil
106
+	if err != nil {
107
+		entry.Logger.mu.Lock()
108
+		fmt.Fprintf(os.Stderr, "Failed to obtain reader, %v\n", err)
109
+		entry.Logger.mu.Unlock()
110
+	} else {
111
+		entry.Logger.mu.Lock()
112
+		_, err = entry.Logger.Out.Write(serialized)
113
+		if err != nil {
114
+			fmt.Fprintf(os.Stderr, "Failed to write to log, %v\n", err)
115
+		}
116
+		entry.Logger.mu.Unlock()
117
+	}
118
+
119
+	// To avoid Entry#log() returning a value that only would make sense for
120
+	// panic() to use in Entry#Panic(), we avoid the allocation by checking
121
+	// directly here.
122
+	if level <= PanicLevel {
123
+		panic(&entry)
124
+	}
125
+}
126
+
127
+func (entry *Entry) Debug(args ...interface{}) {
128
+	if entry.Logger.level() >= DebugLevel {
129
+		entry.log(DebugLevel, fmt.Sprint(args...))
130
+	}
131
+}
132
+
133
+func (entry *Entry) Print(args ...interface{}) {
134
+	entry.Info(args...)
135
+}
136
+
137
+func (entry *Entry) Info(args ...interface{}) {
138
+	if entry.Logger.level() >= InfoLevel {
139
+		entry.log(InfoLevel, fmt.Sprint(args...))
140
+	}
141
+}
142
+
143
+func (entry *Entry) Warn(args ...interface{}) {
144
+	if entry.Logger.level() >= WarnLevel {
145
+		entry.log(WarnLevel, fmt.Sprint(args...))
146
+	}
147
+}
148
+
149
+func (entry *Entry) Warning(args ...interface{}) {
150
+	entry.Warn(args...)
151
+}
152
+
153
+func (entry *Entry) Error(args ...interface{}) {
154
+	if entry.Logger.level() >= ErrorLevel {
155
+		entry.log(ErrorLevel, fmt.Sprint(args...))
156
+	}
157
+}
158
+
159
+func (entry *Entry) Fatal(args ...interface{}) {
160
+	if entry.Logger.level() >= FatalLevel {
161
+		entry.log(FatalLevel, fmt.Sprint(args...))
162
+	}
163
+	Exit(1)
164
+}
165
+
166
+func (entry *Entry) Panic(args ...interface{}) {
167
+	if entry.Logger.level() >= PanicLevel {
168
+		entry.log(PanicLevel, fmt.Sprint(args...))
169
+	}
170
+	panic(fmt.Sprint(args...))
171
+}
172
+
173
+// Entry Printf family functions
174
+
175
+func (entry *Entry) Debugf(format string, args ...interface{}) {
176
+	if entry.Logger.level() >= DebugLevel {
177
+		entry.Debug(fmt.Sprintf(format, args...))
178
+	}
179
+}
180
+
181
+func (entry *Entry) Infof(format string, args ...interface{}) {
182
+	if entry.Logger.level() >= InfoLevel {
183
+		entry.Info(fmt.Sprintf(format, args...))
184
+	}
185
+}
186
+
187
+func (entry *Entry) Printf(format string, args ...interface{}) {
188
+	entry.Infof(format, args...)
189
+}
190
+
191
+func (entry *Entry) Warnf(format string, args ...interface{}) {
192
+	if entry.Logger.level() >= WarnLevel {
193
+		entry.Warn(fmt.Sprintf(format, args...))
194
+	}
195
+}
196
+
197
+func (entry *Entry) Warningf(format string, args ...interface{}) {
198
+	entry.Warnf(format, args...)
199
+}
200
+
201
+func (entry *Entry) Errorf(format string, args ...interface{}) {
202
+	if entry.Logger.level() >= ErrorLevel {
203
+		entry.Error(fmt.Sprintf(format, args...))
204
+	}
205
+}
206
+
207
+func (entry *Entry) Fatalf(format string, args ...interface{}) {
208
+	if entry.Logger.level() >= FatalLevel {
209
+		entry.Fatal(fmt.Sprintf(format, args...))
210
+	}
211
+	Exit(1)
212
+}
213
+
214
+func (entry *Entry) Panicf(format string, args ...interface{}) {
215
+	if entry.Logger.level() >= PanicLevel {
216
+		entry.Panic(fmt.Sprintf(format, args...))
217
+	}
218
+}
219
+
220
+// Entry Println family functions
221
+
222
+func (entry *Entry) Debugln(args ...interface{}) {
223
+	if entry.Logger.level() >= DebugLevel {
224
+		entry.Debug(entry.sprintlnn(args...))
225
+	}
226
+}
227
+
228
+func (entry *Entry) Infoln(args ...interface{}) {
229
+	if entry.Logger.level() >= InfoLevel {
230
+		entry.Info(entry.sprintlnn(args...))
231
+	}
232
+}
233
+
234
+func (entry *Entry) Println(args ...interface{}) {
235
+	entry.Infoln(args...)
236
+}
237
+
238
+func (entry *Entry) Warnln(args ...interface{}) {
239
+	if entry.Logger.level() >= WarnLevel {
240
+		entry.Warn(entry.sprintlnn(args...))
241
+	}
242
+}
243
+
244
+func (entry *Entry) Warningln(args ...interface{}) {
245
+	entry.Warnln(args...)
246
+}
247
+
248
+func (entry *Entry) Errorln(args ...interface{}) {
249
+	if entry.Logger.level() >= ErrorLevel {
250
+		entry.Error(entry.sprintlnn(args...))
251
+	}
252
+}
253
+
254
+func (entry *Entry) Fatalln(args ...interface{}) {
255
+	if entry.Logger.level() >= FatalLevel {
256
+		entry.Fatal(entry.sprintlnn(args...))
257
+	}
258
+	Exit(1)
259
+}
260
+
261
+func (entry *Entry) Panicln(args ...interface{}) {
262
+	if entry.Logger.level() >= PanicLevel {
263
+		entry.Panic(entry.sprintlnn(args...))
264
+	}
265
+}
266
+
267
+// Sprintlnn => Sprint no newline. This is to get the behavior of how
268
+// fmt.Sprintln where spaces are always added between operands, regardless of
269
+// their type. Instead of vendoring the Sprintln implementation to spare a
270
+// string allocation, we do the simplest thing.
271
+func (entry *Entry) sprintlnn(args ...interface{}) string {
272
+	msg := fmt.Sprintln(args...)
273
+	return msg[:len(msg)-1]
274
+}
0 275
new file mode 100644
... ...
@@ -0,0 +1,193 @@
0
+package logrus
1
+
2
+import (
3
+	"io"
4
+)
5
+
6
+var (
7
+	// std is the name of the standard logger in stdlib `log`
8
+	std = New()
9
+)
10
+
11
+func StandardLogger() *Logger {
12
+	return std
13
+}
14
+
15
+// SetOutput sets the standard logger output.
16
+func SetOutput(out io.Writer) {
17
+	std.mu.Lock()
18
+	defer std.mu.Unlock()
19
+	std.Out = out
20
+}
21
+
22
+// SetFormatter sets the standard logger formatter.
23
+func SetFormatter(formatter Formatter) {
24
+	std.mu.Lock()
25
+	defer std.mu.Unlock()
26
+	std.Formatter = formatter
27
+}
28
+
29
+// SetLevel sets the standard logger level.
30
+func SetLevel(level Level) {
31
+	std.mu.Lock()
32
+	defer std.mu.Unlock()
33
+	std.setLevel(level)
34
+}
35
+
36
+// GetLevel returns the standard logger level.
37
+func GetLevel() Level {
38
+	std.mu.Lock()
39
+	defer std.mu.Unlock()
40
+	return std.level()
41
+}
42
+
43
+// AddHook adds a hook to the standard logger hooks.
44
+func AddHook(hook Hook) {
45
+	std.mu.Lock()
46
+	defer std.mu.Unlock()
47
+	std.Hooks.Add(hook)
48
+}
49
+
50
+// WithError creates an entry from the standard logger and adds an error to it, using the value defined in ErrorKey as key.
51
+func WithError(err error) *Entry {
52
+	return std.WithField(ErrorKey, err)
53
+}
54
+
55
+// WithField creates an entry from the standard logger and adds a field to
56
+// it. If you want multiple fields, use `WithFields`.
57
+//
58
+// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal
59
+// or Panic on the Entry it returns.
60
+func WithField(key string, value interface{}) *Entry {
61
+	return std.WithField(key, value)
62
+}
63
+
64
+// WithFields creates an entry from the standard logger and adds multiple
65
+// fields to it. This is simply a helper for `WithField`, invoking it
66
+// once for each field.
67
+//
68
+// Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal
69
+// or Panic on the Entry it returns.
70
+func WithFields(fields Fields) *Entry {
71
+	return std.WithFields(fields)
72
+}
73
+
74
+// Debug logs a message at level Debug on the standard logger.
75
+func Debug(args ...interface{}) {
76
+	std.Debug(args...)
77
+}
78
+
79
+// Print logs a message at level Info on the standard logger.
80
+func Print(args ...interface{}) {
81
+	std.Print(args...)
82
+}
83
+
84
+// Info logs a message at level Info on the standard logger.
85
+func Info(args ...interface{}) {
86
+	std.Info(args...)
87
+}
88
+
89
+// Warn logs a message at level Warn on the standard logger.
90
+func Warn(args ...interface{}) {
91
+	std.Warn(args...)
92
+}
93
+
94
+// Warning logs a message at level Warn on the standard logger.
95
+func Warning(args ...interface{}) {
96
+	std.Warning(args...)
97
+}
98
+
99
+// Error logs a message at level Error on the standard logger.
100
+func Error(args ...interface{}) {
101
+	std.Error(args...)
102
+}
103
+
104
+// Panic logs a message at level Panic on the standard logger.
105
+func Panic(args ...interface{}) {
106
+	std.Panic(args...)
107
+}
108
+
109
+// Fatal logs a message at level Fatal on the standard logger.
110
+func Fatal(args ...interface{}) {
111
+	std.Fatal(args...)
112
+}
113
+
114
+// Debugf logs a message at level Debug on the standard logger.
115
+func Debugf(format string, args ...interface{}) {
116
+	std.Debugf(format, args...)
117
+}
118
+
119
+// Printf logs a message at level Info on the standard logger.
120
+func Printf(format string, args ...interface{}) {
121
+	std.Printf(format, args...)
122
+}
123
+
124
+// Infof logs a message at level Info on the standard logger.
125
+func Infof(format string, args ...interface{}) {
126
+	std.Infof(format, args...)
127
+}
128
+
129
+// Warnf logs a message at level Warn on the standard logger.
130
+func Warnf(format string, args ...interface{}) {
131
+	std.Warnf(format, args...)
132
+}
133
+
134
+// Warningf logs a message at level Warn on the standard logger.
135
+func Warningf(format string, args ...interface{}) {
136
+	std.Warningf(format, args...)
137
+}
138
+
139
+// Errorf logs a message at level Error on the standard logger.
140
+func Errorf(format string, args ...interface{}) {
141
+	std.Errorf(format, args...)
142
+}
143
+
144
+// Panicf logs a message at level Panic on the standard logger.
145
+func Panicf(format string, args ...interface{}) {
146
+	std.Panicf(format, args...)
147
+}
148
+
149
+// Fatalf logs a message at level Fatal on the standard logger.
150
+func Fatalf(format string, args ...interface{}) {
151
+	std.Fatalf(format, args...)
152
+}
153
+
154
+// Debugln logs a message at level Debug on the standard logger.
155
+func Debugln(args ...interface{}) {
156
+	std.Debugln(args...)
157
+}
158
+
159
+// Println logs a message at level Info on the standard logger.
160
+func Println(args ...interface{}) {
161
+	std.Println(args...)
162
+}
163
+
164
+// Infoln logs a message at level Info on the standard logger.
165
+func Infoln(args ...interface{}) {
166
+	std.Infoln(args...)
167
+}
168
+
169
+// Warnln logs a message at level Warn on the standard logger.
170
+func Warnln(args ...interface{}) {
171
+	std.Warnln(args...)
172
+}
173
+
174
+// Warningln logs a message at level Warn on the standard logger.
175
+func Warningln(args ...interface{}) {
176
+	std.Warningln(args...)
177
+}
178
+
179
+// Errorln logs a message at level Error on the standard logger.
180
+func Errorln(args ...interface{}) {
181
+	std.Errorln(args...)
182
+}
183
+
184
+// Panicln logs a message at level Panic on the standard logger.
185
+func Panicln(args ...interface{}) {
186
+	std.Panicln(args...)
187
+}
188
+
189
+// Fatalln logs a message at level Fatal on the standard logger.
190
+func Fatalln(args ...interface{}) {
191
+	std.Fatalln(args...)
192
+}
0 193
new file mode 100644
... ...
@@ -0,0 +1,45 @@
0
+package logrus
1
+
2
+import "time"
3
+
4
+const DefaultTimestampFormat = time.RFC3339
5
+
6
+// The Formatter interface is used to implement a custom Formatter. It takes an
7
+// `Entry`. It exposes all the fields, including the default ones:
8
+//
9
+// * `entry.Data["msg"]`. The message passed from Info, Warn, Error ..
10
+// * `entry.Data["time"]`. The timestamp.
11
+// * `entry.Data["level"]. The level the entry was logged at.
12
+//
13
+// Any additional fields added with `WithField` or `WithFields` are also in
14
+// `entry.Data`. Format is expected to return an array of bytes which are then
15
+// logged to `logger.Out`.
16
+type Formatter interface {
17
+	Format(*Entry) ([]byte, error)
18
+}
19
+
20
+// This is to not silently overwrite `time`, `msg` and `level` fields when
21
+// dumping it. If this code wasn't there doing:
22
+//
23
+//  logrus.WithField("level", 1).Info("hello")
24
+//
25
+// Would just silently drop the user provided level. Instead with this code
26
+// it'll logged as:
27
+//
28
+//  {"level": "info", "fields.level": 1, "msg": "hello", "time": "..."}
29
+//
30
+// It's not exported because it's still using Data in an opinionated way. It's to
31
+// avoid code duplication between the two default formatters.
32
+func prefixFieldClashes(data Fields) {
33
+	if t, ok := data["time"]; ok {
34
+		data["fields.time"] = t
35
+	}
36
+
37
+	if m, ok := data["msg"]; ok {
38
+		data["fields.msg"] = m
39
+	}
40
+
41
+	if l, ok := data["level"]; ok {
42
+		data["fields.level"] = l
43
+	}
44
+}
0 45
new file mode 100644
... ...
@@ -0,0 +1,34 @@
0
+package logrus
1
+
2
+// A hook to be fired when logging on the logging levels returned from
3
+// `Levels()` on your implementation of the interface. Note that this is not
4
+// fired in a goroutine or a channel with workers, you should handle such
5
+// functionality yourself if your call is non-blocking and you don't wish for
6
+// the logging calls for levels returned from `Levels()` to block.
7
+type Hook interface {
8
+	Levels() []Level
9
+	Fire(*Entry) error
10
+}
11
+
12
+// Internal type for storing the hooks on a logger instance.
13
+type LevelHooks map[Level][]Hook
14
+
15
+// Add a hook to an instance of logger. This is called with
16
+// `log.Hooks.Add(new(MyHook))` where `MyHook` implements the `Hook` interface.
17
+func (hooks LevelHooks) Add(hook Hook) {
18
+	for _, level := range hook.Levels() {
19
+		hooks[level] = append(hooks[level], hook)
20
+	}
21
+}
22
+
23
+// Fire all the hooks for the passed level. Used by `entry.log` to fire
24
+// appropriate hooks for a log entry.
25
+func (hooks LevelHooks) Fire(level Level, entry *Entry) error {
26
+	for _, hook := range hooks[level] {
27
+		if err := hook.Fire(entry); err != nil {
28
+			return err
29
+		}
30
+	}
31
+
32
+	return nil
33
+}
0 34
new file mode 100644
... ...
@@ -0,0 +1,74 @@
0
+package logrus
1
+
2
+import (
3
+	"encoding/json"
4
+	"fmt"
5
+)
6
+
7
+type fieldKey string
8
+type FieldMap map[fieldKey]string
9
+
10
+const (
11
+	FieldKeyMsg   = "msg"
12
+	FieldKeyLevel = "level"
13
+	FieldKeyTime  = "time"
14
+)
15
+
16
+func (f FieldMap) resolve(key fieldKey) string {
17
+	if k, ok := f[key]; ok {
18
+		return k
19
+	}
20
+
21
+	return string(key)
22
+}
23
+
24
+type JSONFormatter struct {
25
+	// TimestampFormat sets the format used for marshaling timestamps.
26
+	TimestampFormat string
27
+
28
+	// DisableTimestamp allows disabling automatic timestamps in output
29
+	DisableTimestamp bool
30
+
31
+	// FieldMap allows users to customize the names of keys for various fields.
32
+	// As an example:
33
+	// formatter := &JSONFormatter{
34
+	//   	FieldMap: FieldMap{
35
+	// 		 FieldKeyTime: "@timestamp",
36
+	// 		 FieldKeyLevel: "@level",
37
+	// 		 FieldKeyMsg: "@message",
38
+	//    },
39
+	// }
40
+	FieldMap FieldMap
41
+}
42
+
43
+func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) {
44
+	data := make(Fields, len(entry.Data)+3)
45
+	for k, v := range entry.Data {
46
+		switch v := v.(type) {
47
+		case error:
48
+			// Otherwise errors are ignored by `encoding/json`
49
+			// https://github.com/sirupsen/logrus/issues/137
50
+			data[k] = v.Error()
51
+		default:
52
+			data[k] = v
53
+		}
54
+	}
55
+	prefixFieldClashes(data)
56
+
57
+	timestampFormat := f.TimestampFormat
58
+	if timestampFormat == "" {
59
+		timestampFormat = DefaultTimestampFormat
60
+	}
61
+
62
+	if !f.DisableTimestamp {
63
+		data[f.FieldMap.resolve(FieldKeyTime)] = entry.Time.Format(timestampFormat)
64
+	}
65
+	data[f.FieldMap.resolve(FieldKeyMsg)] = entry.Message
66
+	data[f.FieldMap.resolve(FieldKeyLevel)] = entry.Level.String()
67
+
68
+	serialized, err := json.Marshal(data)
69
+	if err != nil {
70
+		return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err)
71
+	}
72
+	return append(serialized, '\n'), nil
73
+}
0 74
new file mode 100644
... ...
@@ -0,0 +1,317 @@
0
+package logrus
1
+
2
+import (
3
+	"io"
4
+	"os"
5
+	"sync"
6
+	"sync/atomic"
7
+)
8
+
9
+type Logger struct {
10
+	// The logs are `io.Copy`'d to this in a mutex. It's common to set this to a
11
+	// file, or leave it default which is `os.Stderr`. You can also set this to
12
+	// something more adventorous, such as logging to Kafka.
13
+	Out io.Writer
14
+	// Hooks for the logger instance. These allow firing events based on logging
15
+	// levels and log entries. For example, to send errors to an error tracking
16
+	// service, log to StatsD or dump the core on fatal errors.
17
+	Hooks LevelHooks
18
+	// All log entries pass through the formatter before logged to Out. The
19
+	// included formatters are `TextFormatter` and `JSONFormatter` for which
20
+	// TextFormatter is the default. In development (when a TTY is attached) it
21
+	// logs with colors, but to a file it wouldn't. You can easily implement your
22
+	// own that implements the `Formatter` interface, see the `README` or included
23
+	// formatters for examples.
24
+	Formatter Formatter
25
+	// The logging level the logger should log at. This is typically (and defaults
26
+	// to) `logrus.Info`, which allows Info(), Warn(), Error() and Fatal() to be
27
+	// logged. `logrus.Debug` is useful in
28
+	Level Level
29
+	// Used to sync writing to the log. Locking is enabled by Default
30
+	mu MutexWrap
31
+	// Reusable empty entry
32
+	entryPool sync.Pool
33
+}
34
+
35
+type MutexWrap struct {
36
+	lock     sync.Mutex
37
+	disabled bool
38
+}
39
+
40
+func (mw *MutexWrap) Lock() {
41
+	if !mw.disabled {
42
+		mw.lock.Lock()
43
+	}
44
+}
45
+
46
+func (mw *MutexWrap) Unlock() {
47
+	if !mw.disabled {
48
+		mw.lock.Unlock()
49
+	}
50
+}
51
+
52
+func (mw *MutexWrap) Disable() {
53
+	mw.disabled = true
54
+}
55
+
56
+// Creates a new logger. Configuration should be set by changing `Formatter`,
57
+// `Out` and `Hooks` directly on the default logger instance. You can also just
58
+// instantiate your own:
59
+//
60
+//    var log = &Logger{
61
+//      Out: os.Stderr,
62
+//      Formatter: new(JSONFormatter),
63
+//      Hooks: make(LevelHooks),
64
+//      Level: logrus.DebugLevel,
65
+//    }
66
+//
67
+// It's recommended to make this a global instance called `log`.
68
+func New() *Logger {
69
+	return &Logger{
70
+		Out:       os.Stderr,
71
+		Formatter: new(TextFormatter),
72
+		Hooks:     make(LevelHooks),
73
+		Level:     InfoLevel,
74
+	}
75
+}
76
+
77
+func (logger *Logger) newEntry() *Entry {
78
+	entry, ok := logger.entryPool.Get().(*Entry)
79
+	if ok {
80
+		return entry
81
+	}
82
+	return NewEntry(logger)
83
+}
84
+
85
+func (logger *Logger) releaseEntry(entry *Entry) {
86
+	logger.entryPool.Put(entry)
87
+}
88
+
89
+// Adds a field to the log entry, note that it doesn't log until you call
90
+// Debug, Print, Info, Warn, Fatal or Panic. It only creates a log entry.
91
+// If you want multiple fields, use `WithFields`.
92
+func (logger *Logger) WithField(key string, value interface{}) *Entry {
93
+	entry := logger.newEntry()
94
+	defer logger.releaseEntry(entry)
95
+	return entry.WithField(key, value)
96
+}
97
+
98
+// Adds a struct of fields to the log entry. All it does is call `WithField` for
99
+// each `Field`.
100
+func (logger *Logger) WithFields(fields Fields) *Entry {
101
+	entry := logger.newEntry()
102
+	defer logger.releaseEntry(entry)
103
+	return entry.WithFields(fields)
104
+}
105
+
106
+// Add an error as single field to the log entry.  All it does is call
107
+// `WithError` for the given `error`.
108
+func (logger *Logger) WithError(err error) *Entry {
109
+	entry := logger.newEntry()
110
+	defer logger.releaseEntry(entry)
111
+	return entry.WithError(err)
112
+}
113
+
114
+func (logger *Logger) Debugf(format string, args ...interface{}) {
115
+	if logger.level() >= DebugLevel {
116
+		entry := logger.newEntry()
117
+		entry.Debugf(format, args...)
118
+		logger.releaseEntry(entry)
119
+	}
120
+}
121
+
122
+func (logger *Logger) Infof(format string, args ...interface{}) {
123
+	if logger.level() >= InfoLevel {
124
+		entry := logger.newEntry()
125
+		entry.Infof(format, args...)
126
+		logger.releaseEntry(entry)
127
+	}
128
+}
129
+
130
+func (logger *Logger) Printf(format string, args ...interface{}) {
131
+	entry := logger.newEntry()
132
+	entry.Printf(format, args...)
133
+	logger.releaseEntry(entry)
134
+}
135
+
136
+func (logger *Logger) Warnf(format string, args ...interface{}) {
137
+	if logger.level() >= WarnLevel {
138
+		entry := logger.newEntry()
139
+		entry.Warnf(format, args...)
140
+		logger.releaseEntry(entry)
141
+	}
142
+}
143
+
144
+func (logger *Logger) Warningf(format string, args ...interface{}) {
145
+	if logger.level() >= WarnLevel {
146
+		entry := logger.newEntry()
147
+		entry.Warnf(format, args...)
148
+		logger.releaseEntry(entry)
149
+	}
150
+}
151
+
152
+func (logger *Logger) Errorf(format string, args ...interface{}) {
153
+	if logger.level() >= ErrorLevel {
154
+		entry := logger.newEntry()
155
+		entry.Errorf(format, args...)
156
+		logger.releaseEntry(entry)
157
+	}
158
+}
159
+
160
+func (logger *Logger) Fatalf(format string, args ...interface{}) {
161
+	if logger.level() >= FatalLevel {
162
+		entry := logger.newEntry()
163
+		entry.Fatalf(format, args...)
164
+		logger.releaseEntry(entry)
165
+	}
166
+	Exit(1)
167
+}
168
+
169
+func (logger *Logger) Panicf(format string, args ...interface{}) {
170
+	if logger.level() >= PanicLevel {
171
+		entry := logger.newEntry()
172
+		entry.Panicf(format, args...)
173
+		logger.releaseEntry(entry)
174
+	}
175
+}
176
+
177
+func (logger *Logger) Debug(args ...interface{}) {
178
+	if logger.level() >= DebugLevel {
179
+		entry := logger.newEntry()
180
+		entry.Debug(args...)
181
+		logger.releaseEntry(entry)
182
+	}
183
+}
184
+
185
+func (logger *Logger) Info(args ...interface{}) {
186
+	if logger.level() >= InfoLevel {
187
+		entry := logger.newEntry()
188
+		entry.Info(args...)
189
+		logger.releaseEntry(entry)
190
+	}
191
+}
192
+
193
+func (logger *Logger) Print(args ...interface{}) {
194
+	entry := logger.newEntry()
195
+	entry.Info(args...)
196
+	logger.releaseEntry(entry)
197
+}
198
+
199
+func (logger *Logger) Warn(args ...interface{}) {
200
+	if logger.level() >= WarnLevel {
201
+		entry := logger.newEntry()
202
+		entry.Warn(args...)
203
+		logger.releaseEntry(entry)
204
+	}
205
+}
206
+
207
+func (logger *Logger) Warning(args ...interface{}) {
208
+	if logger.level() >= WarnLevel {
209
+		entry := logger.newEntry()
210
+		entry.Warn(args...)
211
+		logger.releaseEntry(entry)
212
+	}
213
+}
214
+
215
+func (logger *Logger) Error(args ...interface{}) {
216
+	if logger.level() >= ErrorLevel {
217
+		entry := logger.newEntry()
218
+		entry.Error(args...)
219
+		logger.releaseEntry(entry)
220
+	}
221
+}
222
+
223
+func (logger *Logger) Fatal(args ...interface{}) {
224
+	if logger.level() >= FatalLevel {
225
+		entry := logger.newEntry()
226
+		entry.Fatal(args...)
227
+		logger.releaseEntry(entry)
228
+	}
229
+	Exit(1)
230
+}
231
+
232
+func (logger *Logger) Panic(args ...interface{}) {
233
+	if logger.level() >= PanicLevel {
234
+		entry := logger.newEntry()
235
+		entry.Panic(args...)
236
+		logger.releaseEntry(entry)
237
+	}
238
+}
239
+
240
+func (logger *Logger) Debugln(args ...interface{}) {
241
+	if logger.level() >= DebugLevel {
242
+		entry := logger.newEntry()
243
+		entry.Debugln(args...)
244
+		logger.releaseEntry(entry)
245
+	}
246
+}
247
+
248
+func (logger *Logger) Infoln(args ...interface{}) {
249
+	if logger.level() >= InfoLevel {
250
+		entry := logger.newEntry()
251
+		entry.Infoln(args...)
252
+		logger.releaseEntry(entry)
253
+	}
254
+}
255
+
256
+func (logger *Logger) Println(args ...interface{}) {
257
+	entry := logger.newEntry()
258
+	entry.Println(args...)
259
+	logger.releaseEntry(entry)
260
+}
261
+
262
+func (logger *Logger) Warnln(args ...interface{}) {
263
+	if logger.level() >= WarnLevel {
264
+		entry := logger.newEntry()
265
+		entry.Warnln(args...)
266
+		logger.releaseEntry(entry)
267
+	}
268
+}
269
+
270
+func (logger *Logger) Warningln(args ...interface{}) {
271
+	if logger.level() >= WarnLevel {
272
+		entry := logger.newEntry()
273
+		entry.Warnln(args...)
274
+		logger.releaseEntry(entry)
275
+	}
276
+}
277
+
278
+func (logger *Logger) Errorln(args ...interface{}) {
279
+	if logger.level() >= ErrorLevel {
280
+		entry := logger.newEntry()
281
+		entry.Errorln(args...)
282
+		logger.releaseEntry(entry)
283
+	}
284
+}
285
+
286
+func (logger *Logger) Fatalln(args ...interface{}) {
287
+	if logger.level() >= FatalLevel {
288
+		entry := logger.newEntry()
289
+		entry.Fatalln(args...)
290
+		logger.releaseEntry(entry)
291
+	}
292
+	Exit(1)
293
+}
294
+
295
+func (logger *Logger) Panicln(args ...interface{}) {
296
+	if logger.level() >= PanicLevel {
297
+		entry := logger.newEntry()
298
+		entry.Panicln(args...)
299
+		logger.releaseEntry(entry)
300
+	}
301
+}
302
+
303
+//When file is opened with appending mode, it's safe to
304
+//write concurrently to a file (within 4k message on Linux).
305
+//In these cases user can choose to disable the lock.
306
+func (logger *Logger) SetNoLock() {
307
+	logger.mu.Disable()
308
+}
309
+
310
+func (logger *Logger) level() Level {
311
+	return Level(atomic.LoadUint32((*uint32)(&logger.Level)))
312
+}
313
+
314
+func (logger *Logger) setLevel(level Level) {
315
+	atomic.StoreUint32((*uint32)(&logger.Level), uint32(level))
316
+}
0 317
new file mode 100644
... ...
@@ -0,0 +1,143 @@
0
+package logrus
1
+
2
+import (
3
+	"fmt"
4
+	"log"
5
+	"strings"
6
+)
7
+
8
+// Fields type, used to pass to `WithFields`.
9
+type Fields map[string]interface{}
10
+
11
+// Level type
12
+type Level uint32
13
+
14
+// Convert the Level to a string. E.g. PanicLevel becomes "panic".
15
+func (level Level) String() string {
16
+	switch level {
17
+	case DebugLevel:
18
+		return "debug"
19
+	case InfoLevel:
20
+		return "info"
21
+	case WarnLevel:
22
+		return "warning"
23
+	case ErrorLevel:
24
+		return "error"
25
+	case FatalLevel:
26
+		return "fatal"
27
+	case PanicLevel:
28
+		return "panic"
29
+	}
30
+
31
+	return "unknown"
32
+}
33
+
34
+// ParseLevel takes a string level and returns the Logrus log level constant.
35
+func ParseLevel(lvl string) (Level, error) {
36
+	switch strings.ToLower(lvl) {
37
+	case "panic":
38
+		return PanicLevel, nil
39
+	case "fatal":
40
+		return FatalLevel, nil
41
+	case "error":
42
+		return ErrorLevel, nil
43
+	case "warn", "warning":
44
+		return WarnLevel, nil
45
+	case "info":
46
+		return InfoLevel, nil
47
+	case "debug":
48
+		return DebugLevel, nil
49
+	}
50
+
51
+	var l Level
52
+	return l, fmt.Errorf("not a valid logrus Level: %q", lvl)
53
+}
54
+
55
+// A constant exposing all logging levels
56
+var AllLevels = []Level{
57
+	PanicLevel,
58
+	FatalLevel,
59
+	ErrorLevel,
60
+	WarnLevel,
61
+	InfoLevel,
62
+	DebugLevel,
63
+}
64
+
65
+// These are the different logging levels. You can set the logging level to log
66
+// on your instance of logger, obtained with `logrus.New()`.
67
+const (
68
+	// PanicLevel level, highest level of severity. Logs and then calls panic with the
69
+	// message passed to Debug, Info, ...
70
+	PanicLevel Level = iota
71
+	// FatalLevel level. Logs and then calls `os.Exit(1)`. It will exit even if the
72
+	// logging level is set to Panic.
73
+	FatalLevel
74
+	// ErrorLevel level. Logs. Used for errors that should definitely be noted.
75
+	// Commonly used for hooks to send errors to an error tracking service.
76
+	ErrorLevel
77
+	// WarnLevel level. Non-critical entries that deserve eyes.
78
+	WarnLevel
79
+	// InfoLevel level. General operational entries about what's going on inside the
80
+	// application.
81
+	InfoLevel
82
+	// DebugLevel level. Usually only enabled when debugging. Very verbose logging.
83
+	DebugLevel
84
+)
85
+
86
+// Won't compile if StdLogger can't be realized by a log.Logger
87
+var (
88
+	_ StdLogger = &log.Logger{}
89
+	_ StdLogger = &Entry{}
90
+	_ StdLogger = &Logger{}
91
+)
92
+
93
+// StdLogger is what your logrus-enabled library should take, that way
94
+// it'll accept a stdlib logger and a logrus logger. There's no standard
95
+// interface, this is the closest we get, unfortunately.
96
+type StdLogger interface {
97
+	Print(...interface{})
98
+	Printf(string, ...interface{})
99
+	Println(...interface{})
100
+
101
+	Fatal(...interface{})
102
+	Fatalf(string, ...interface{})
103
+	Fatalln(...interface{})
104
+
105
+	Panic(...interface{})
106
+	Panicf(string, ...interface{})
107
+	Panicln(...interface{})
108
+}
109
+
110
+// The FieldLogger interface generalizes the Entry and Logger types
111
+type FieldLogger interface {
112
+	WithField(key string, value interface{}) *Entry
113
+	WithFields(fields Fields) *Entry
114
+	WithError(err error) *Entry
115
+
116
+	Debugf(format string, args ...interface{})
117
+	Infof(format string, args ...interface{})
118
+	Printf(format string, args ...interface{})
119
+	Warnf(format string, args ...interface{})
120
+	Warningf(format string, args ...interface{})
121
+	Errorf(format string, args ...interface{})
122
+	Fatalf(format string, args ...interface{})
123
+	Panicf(format string, args ...interface{})
124
+
125
+	Debug(args ...interface{})
126
+	Info(args ...interface{})
127
+	Print(args ...interface{})
128
+	Warn(args ...interface{})
129
+	Warning(args ...interface{})
130
+	Error(args ...interface{})
131
+	Fatal(args ...interface{})
132
+	Panic(args ...interface{})
133
+
134
+	Debugln(args ...interface{})
135
+	Infoln(args ...interface{})
136
+	Println(args ...interface{})
137
+	Warnln(args ...interface{})
138
+	Warningln(args ...interface{})
139
+	Errorln(args ...interface{})
140
+	Fatalln(args ...interface{})
141
+	Panicln(args ...interface{})
142
+}
0 143
new file mode 100644
... ...
@@ -0,0 +1,10 @@
0
+// +build appengine
1
+
2
+package logrus
3
+
4
+import "io"
5
+
6
+// IsTerminal returns true if stderr's file descriptor is a terminal.
7
+func IsTerminal(f io.Writer) bool {
8
+	return true
9
+}
0 10
new file mode 100644
... ...
@@ -0,0 +1,10 @@
0
+// +build darwin freebsd openbsd netbsd dragonfly
1
+// +build !appengine
2
+
3
+package logrus
4
+
5
+import "syscall"
6
+
7
+const ioctlReadTermios = syscall.TIOCGETA
8
+
9
+type Termios syscall.Termios
0 10
new file mode 100644
... ...
@@ -0,0 +1,14 @@
0
+// Based on ssh/terminal:
1
+// Copyright 2013 The Go Authors. All rights reserved.
2
+// Use of this source code is governed by a BSD-style
3
+// license that can be found in the LICENSE file.
4
+
5
+// +build !appengine
6
+
7
+package logrus
8
+
9
+import "syscall"
10
+
11
+const ioctlReadTermios = syscall.TCGETS
12
+
13
+type Termios syscall.Termios
0 14
new file mode 100644
... ...
@@ -0,0 +1,28 @@
0
+// Based on ssh/terminal:
1
+// Copyright 2011 The Go Authors. All rights reserved.
2
+// Use of this source code is governed by a BSD-style
3
+// license that can be found in the LICENSE file.
4
+
5
+// +build linux darwin freebsd openbsd netbsd dragonfly
6
+// +build !appengine
7
+
8
+package logrus
9
+
10
+import (
11
+	"io"
12
+	"os"
13
+	"syscall"
14
+	"unsafe"
15
+)
16
+
17
+// IsTerminal returns true if stderr's file descriptor is a terminal.
18
+func IsTerminal(f io.Writer) bool {
19
+	var termios Termios
20
+	switch v := f.(type) {
21
+	case *os.File:
22
+		_, _, err := syscall.Syscall6(syscall.SYS_IOCTL, uintptr(v.Fd()), ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
23
+		return err == 0
24
+	default:
25
+		return false
26
+	}
27
+}
0 28
new file mode 100644
... ...
@@ -0,0 +1,21 @@
0
+// +build solaris,!appengine
1
+
2
+package logrus
3
+
4
+import (
5
+	"io"
6
+	"os"
7
+
8
+	"golang.org/x/sys/unix"
9
+)
10
+
11
+// IsTerminal returns true if the given file descriptor is a terminal.
12
+func IsTerminal(f io.Writer) bool {
13
+	switch v := f.(type) {
14
+	case *os.File:
15
+		_, err := unix.IoctlGetTermios(int(v.Fd()), unix.TCGETA)
16
+		return err == nil
17
+	default:
18
+		return false
19
+	}
20
+}
0 21
new file mode 100644
... ...
@@ -0,0 +1,82 @@
0
+// Based on ssh/terminal:
1
+// Copyright 2011 The Go Authors. All rights reserved.
2
+// Use of this source code is governed by a BSD-style
3
+// license that can be found in the LICENSE file.
4
+
5
+// +build windows,!appengine
6
+
7
+package logrus
8
+
9
+import (
10
+	"bytes"
11
+	"errors"
12
+	"io"
13
+	"os"
14
+	"os/exec"
15
+	"strconv"
16
+	"strings"
17
+	"syscall"
18
+	"unsafe"
19
+)
20
+
21
+var kernel32 = syscall.NewLazyDLL("kernel32.dll")
22
+
23
+var (
24
+	procGetConsoleMode = kernel32.NewProc("GetConsoleMode")
25
+	procSetConsoleMode = kernel32.NewProc("SetConsoleMode")
26
+)
27
+
28
+const (
29
+	enableProcessedOutput           = 0x0001
30
+	enableWrapAtEolOutput           = 0x0002
31
+	enableVirtualTerminalProcessing = 0x0004
32
+)
33
+
34
+func getVersion() (float64, error) {
35
+	stdout, stderr := &bytes.Buffer{}, &bytes.Buffer{}
36
+	cmd := exec.Command("cmd", "ver")
37
+	cmd.Stdout = stdout
38
+	cmd.Stderr = stderr
39
+	err := cmd.Run()
40
+	if err != nil {
41
+		return -1, err
42
+	}
43
+	
44
+	// The output should be like "Microsoft Windows [Version XX.X.XXXXXX]"
45
+	version := strings.Replace(stdout.String(), "\n", "", -1)
46
+	version = strings.Replace(version, "\r\n", "", -1)
47
+
48
+	x1 := strings.Index(version, "[Version")
49
+
50
+	if x1 == -1 || strings.Index(version, "]") == -1 {
51
+		return -1, errors.New("Can't determine Windows version")
52
+	}
53
+
54
+	return strconv.ParseFloat(version[x1+9:x1+13], 64)
55
+}
56
+
57
+func init() {
58
+	ver, err := getVersion()
59
+	if err != nil {
60
+		return
61
+	}
62
+
63
+	// Activate Virtual Processing for Windows CMD
64
+	// Info: https://msdn.microsoft.com/en-us/library/windows/desktop/ms686033(v=vs.85).aspx
65
+	if ver >= 10 {
66
+		handle := syscall.Handle(os.Stderr.Fd())
67
+		procSetConsoleMode.Call(uintptr(handle), enableProcessedOutput|enableWrapAtEolOutput|enableVirtualTerminalProcessing)
68
+	}
69
+}
70
+
71
+// IsTerminal returns true if stderr's file descriptor is a terminal.
72
+func IsTerminal(f io.Writer) bool {
73
+	switch v := f.(type) {
74
+	case *os.File:
75
+		var st uint32
76
+		r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(v.Fd()), uintptr(unsafe.Pointer(&st)), 0)
77
+		return r != 0 && e == 0
78
+	default:
79
+		return false
80
+	}
81
+}
0 82
new file mode 100644
... ...
@@ -0,0 +1,196 @@
0
+package logrus
1
+
2
+import (
3
+	"bytes"
4
+	"fmt"
5
+	"sort"
6
+	"strings"
7
+	"sync"
8
+	"time"
9
+)
10
+
11
+const (
12
+	nocolor = 0
13
+	red     = 31
14
+	green   = 32
15
+	yellow  = 33
16
+	blue    = 34
17
+	gray    = 37
18
+)
19
+
20
+var (
21
+	baseTimestamp time.Time
22
+)
23
+
24
+func init() {
25
+	baseTimestamp = time.Now()
26
+}
27
+
28
+type TextFormatter struct {
29
+	// Set to true to bypass checking for a TTY before outputting colors.
30
+	ForceColors bool
31
+
32
+	// Force disabling colors.
33
+	DisableColors bool
34
+
35
+	// Disable timestamp logging. useful when output is redirected to logging
36
+	// system that already adds timestamps.
37
+	DisableTimestamp bool
38
+
39
+	// Enable logging the full timestamp when a TTY is attached instead of just
40
+	// the time passed since beginning of execution.
41
+	FullTimestamp bool
42
+
43
+	// TimestampFormat to use for display when a full timestamp is printed
44
+	TimestampFormat string
45
+
46
+	// The fields are sorted by default for a consistent output. For applications
47
+	// that log extremely frequently and don't use the JSON formatter this may not
48
+	// be desired.
49
+	DisableSorting bool
50
+
51
+	// QuoteEmptyFields will wrap empty fields in quotes if true
52
+	QuoteEmptyFields bool
53
+
54
+	// QuoteCharacter can be set to the override the default quoting character "
55
+	// with something else. For example: ', or `.
56
+	QuoteCharacter string
57
+
58
+	// Whether the logger's out is to a terminal
59
+	isTerminal bool
60
+
61
+	sync.Once
62
+}
63
+
64
+func (f *TextFormatter) init(entry *Entry) {
65
+	if len(f.QuoteCharacter) == 0 {
66
+		f.QuoteCharacter = "\""
67
+	}
68
+	if entry.Logger != nil {
69
+		f.isTerminal = IsTerminal(entry.Logger.Out)
70
+	}
71
+}
72
+
73
+func (f *TextFormatter) Format(entry *Entry) ([]byte, error) {
74
+	var b *bytes.Buffer
75
+	keys := make([]string, 0, len(entry.Data))
76
+	for k := range entry.Data {
77
+		keys = append(keys, k)
78
+	}
79
+
80
+	if !f.DisableSorting {
81
+		sort.Strings(keys)
82
+	}
83
+	if entry.Buffer != nil {
84
+		b = entry.Buffer
85
+	} else {
86
+		b = &bytes.Buffer{}
87
+	}
88
+
89
+	prefixFieldClashes(entry.Data)
90
+
91
+	f.Do(func() { f.init(entry) })
92
+
93
+	isColored := (f.ForceColors || f.isTerminal) && !f.DisableColors
94
+
95
+	timestampFormat := f.TimestampFormat
96
+	if timestampFormat == "" {
97
+		timestampFormat = DefaultTimestampFormat
98
+	}
99
+	if isColored {
100
+		f.printColored(b, entry, keys, timestampFormat)
101
+	} else {
102
+		if !f.DisableTimestamp {
103
+			f.appendKeyValue(b, "time", entry.Time.Format(timestampFormat))
104
+		}
105
+		f.appendKeyValue(b, "level", entry.Level.String())
106
+		if entry.Message != "" {
107
+			f.appendKeyValue(b, "msg", entry.Message)
108
+		}
109
+		for _, key := range keys {
110
+			f.appendKeyValue(b, key, entry.Data[key])
111
+		}
112
+	}
113
+
114
+	b.WriteByte('\n')
115
+	return b.Bytes(), nil
116
+}
117
+
118
+func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []string, timestampFormat string) {
119
+	var levelColor int
120
+	switch entry.Level {
121
+	case DebugLevel:
122
+		levelColor = gray
123
+	case WarnLevel:
124
+		levelColor = yellow
125
+	case ErrorLevel, FatalLevel, PanicLevel:
126
+		levelColor = red
127
+	default:
128
+		levelColor = blue
129
+	}
130
+
131
+	levelText := strings.ToUpper(entry.Level.String())[0:4]
132
+
133
+	if f.DisableTimestamp {
134
+		fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m %-44s ", levelColor, levelText, entry.Message)
135
+	} else if !f.FullTimestamp {
136
+		fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%04d] %-44s ", levelColor, levelText, int(entry.Time.Sub(baseTimestamp)/time.Second), entry.Message)
137
+	} else {
138
+		fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%s] %-44s ", levelColor, levelText, entry.Time.Format(timestampFormat), entry.Message)
139
+	}
140
+	for _, k := range keys {
141
+		v := entry.Data[k]
142
+		fmt.Fprintf(b, " \x1b[%dm%s\x1b[0m=", levelColor, k)
143
+		f.appendValue(b, v)
144
+	}
145
+}
146
+
147
+func (f *TextFormatter) needsQuoting(text string) bool {
148
+	if f.QuoteEmptyFields && len(text) == 0 {
149
+		return true
150
+	}
151
+	for _, ch := range text {
152
+		if !((ch >= 'a' && ch <= 'z') ||
153
+			(ch >= 'A' && ch <= 'Z') ||
154
+			(ch >= '0' && ch <= '9') ||
155
+			ch == '-' || ch == '.') {
156
+			return true
157
+		}
158
+	}
159
+	return false
160
+}
161
+
162
+func (f *TextFormatter) appendKeyValue(b *bytes.Buffer, key string, value interface{}) {
163
+
164
+	b.WriteString(key)
165
+	b.WriteByte('=')
166
+	f.appendValue(b, value)
167
+	b.WriteByte(' ')
168
+}
169
+
170
+func (f *TextFormatter) appendValue(b *bytes.Buffer, value interface{}) {
171
+	switch value := value.(type) {
172
+	case string:
173
+		if !f.needsQuoting(value) {
174
+			b.WriteString(value)
175
+		} else {
176
+			b.WriteString(f.quoteString(value))
177
+		}
178
+	case error:
179
+		errmsg := value.Error()
180
+		if !f.needsQuoting(errmsg) {
181
+			b.WriteString(errmsg)
182
+		} else {
183
+			b.WriteString(f.quoteString(errmsg))
184
+		}
185
+	default:
186
+		fmt.Fprint(b, value)
187
+	}
188
+}
189
+
190
+func (f *TextFormatter) quoteString(v string) string {
191
+	escapedQuote := fmt.Sprintf("\\%s", f.QuoteCharacter)
192
+	escapedValue := strings.Replace(v, f.QuoteCharacter, escapedQuote, -1)
193
+
194
+	return fmt.Sprintf("%s%v%s", f.QuoteCharacter, escapedValue, f.QuoteCharacter)
195
+}
0 196
new file mode 100644
... ...
@@ -0,0 +1,62 @@
0
+package logrus
1
+
2
+import (
3
+	"bufio"
4
+	"io"
5
+	"runtime"
6
+)
7
+
8
+func (logger *Logger) Writer() *io.PipeWriter {
9
+	return logger.WriterLevel(InfoLevel)
10
+}
11
+
12
+func (logger *Logger) WriterLevel(level Level) *io.PipeWriter {
13
+	return NewEntry(logger).WriterLevel(level)
14
+}
15
+
16
+func (entry *Entry) Writer() *io.PipeWriter {
17
+	return entry.WriterLevel(InfoLevel)
18
+}
19
+
20
+func (entry *Entry) WriterLevel(level Level) *io.PipeWriter {
21
+	reader, writer := io.Pipe()
22
+
23
+	var printFunc func(args ...interface{})
24
+
25
+	switch level {
26
+	case DebugLevel:
27
+		printFunc = entry.Debug
28
+	case InfoLevel:
29
+		printFunc = entry.Info
30
+	case WarnLevel:
31
+		printFunc = entry.Warn
32
+	case ErrorLevel:
33
+		printFunc = entry.Error
34
+	case FatalLevel:
35
+		printFunc = entry.Fatal
36
+	case PanicLevel:
37
+		printFunc = entry.Panic
38
+	default:
39
+		printFunc = entry.Print
40
+	}
41
+
42
+	go entry.writerScanner(reader, printFunc)
43
+	runtime.SetFinalizer(writer, writerFinalizer)
44
+
45
+	return writer
46
+}
47
+
48
+func (entry *Entry) writerScanner(reader *io.PipeReader, printFunc func(args ...interface{})) {
49
+	scanner := bufio.NewScanner(reader)
50
+	for scanner.Scan() {
51
+		printFunc(scanner.Text())
52
+	}
53
+	if err := scanner.Err(); err != nil {
54
+		entry.Errorf("Error while reading from Writer: %s", err)
55
+	}
56
+	reader.Close()
57
+}
58
+
59
+func writerFinalizer(writer *io.PipeWriter) {
60
+	writer.Close()
61
+}
... ...
@@ -6,8 +6,8 @@ import (
6 6
 	"strings"
7 7
 	"time"
8 8
 
9
-	"github.com/Sirupsen/logrus"
10 9
 	"github.com/docker/docker/volume"
10
+	"github.com/sirupsen/logrus"
11 11
 )
12 12
 
13 13
 var (
... ...
@@ -15,11 +15,11 @@ import (
15 15
 
16 16
 	"github.com/pkg/errors"
17 17
 
18
-	"github.com/Sirupsen/logrus"
19 18
 	"github.com/docker/docker/api"
20 19
 	"github.com/docker/docker/pkg/idtools"
21 20
 	"github.com/docker/docker/pkg/mount"
22 21
 	"github.com/docker/docker/volume"
22
+	"github.com/sirupsen/logrus"
23 23
 )
24 24
 
25 25
 // VolumeDataPathName is the name of the directory where the volume data is stored.
... ...
@@ -3,9 +3,9 @@ package store
3 3
 import (
4 4
 	"encoding/json"
5 5
 
6
-	"github.com/Sirupsen/logrus"
7 6
 	"github.com/boltdb/bolt"
8 7
 	"github.com/pkg/errors"
8
+	"github.com/sirupsen/logrus"
9 9
 )
10 10
 
11 11
 var volumeBucketName = []byte("volumes")
... ...
@@ -3,10 +3,10 @@ package store
3 3
 import (
4 4
 	"sync"
5 5
 
6
-	"github.com/Sirupsen/logrus"
7 6
 	"github.com/boltdb/bolt"
8 7
 	"github.com/docker/docker/volume"
9 8
 	"github.com/docker/docker/volume/drivers"
9
+	"github.com/sirupsen/logrus"
10 10
 )
11 11
 
12 12
 // restore is called when a new volume store is created.
... ...
@@ -9,11 +9,11 @@ import (
9 9
 
10 10
 	"github.com/pkg/errors"
11 11
 
12
-	"github.com/Sirupsen/logrus"
13 12
 	"github.com/boltdb/bolt"
14 13
 	"github.com/docker/docker/pkg/locker"
15 14
 	"github.com/docker/docker/volume"
16 15
 	"github.com/docker/docker/volume/drivers"
16
+	"github.com/sirupsen/logrus"
17 17
 )
18 18
 
19 19
 const (