Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dex
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
dex
Commits
d9778fda
Commit
d9778fda
authored
Jul 25, 2017
by
Eric Stroczynski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vendor: revendor
parent
4a88d064
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
270 additions
and
129 deletions
+270
-129
glide.lock
glide.lock
+4
-4
terminal_windows.go
vendor/github.com/Sirupsen/logrus/terminal_windows.go
+0
-27
LICENSE
vendor/github.com/sirupsen/logrus/LICENSE
+0
-0
alt_exit.go
vendor/github.com/sirupsen/logrus/alt_exit.go
+1
-1
doc.go
vendor/github.com/sirupsen/logrus/doc.go
+2
-2
entry.go
vendor/github.com/sirupsen/logrus/entry.go
+18
-18
exported.go
vendor/github.com/sirupsen/logrus/exported.go
+2
-2
formatter.go
vendor/github.com/sirupsen/logrus/formatter.go
+0
-0
hooks.go
vendor/github.com/sirupsen/logrus/hooks.go
+0
-0
json_formatter.go
vendor/github.com/sirupsen/logrus/json_formatter.go
+37
-4
logger.go
vendor/github.com/sirupsen/logrus/logger.go
+30
-21
logrus.go
vendor/github.com/sirupsen/logrus/logrus.go
+1
-1
terminal_appengine.go
vendor/github.com/sirupsen/logrus/terminal_appengine.go
+3
-1
terminal_bsd.go
vendor/github.com/sirupsen/logrus/terminal_bsd.go
+0
-0
terminal_linux.go
vendor/github.com/sirupsen/logrus/terminal_linux.go
+0
-0
terminal_notwindows.go
vendor/github.com/sirupsen/logrus/terminal_notwindows.go
+10
-4
terminal_solaris.go
vendor/github.com/sirupsen/logrus/terminal_solaris.go
+9
-3
terminal_windows.go
vendor/github.com/sirupsen/logrus/terminal_windows.go
+82
-0
text_formatter.go
vendor/github.com/sirupsen/logrus/text_formatter.go
+52
-31
writer.go
vendor/github.com/sirupsen/logrus/writer.go
+19
-10
No files found.
glide.lock
View file @
d9778fda
hash:
94ea60e268ee0ed04e8affdee4db2884fd93ee68ed625d88ccc0e24565b98569
updated: 2017-0
4-13T11:28:49.008994259
-07:00
hash:
e83f57fea75d4a509d812fab12785599fdab16db950cc3738cec59a6c73f93af
updated: 2017-0
7-25T13:48:39.899190846
-07:00
imports:
- name: github.com/beevik/etree
version: 4cd0dd976db869f817248477718071a28e978df0
...
...
@@ -52,8 +52,8 @@ imports:
subpackages:
- etreeutils
- types
- name: github.com/
S
irupsen/logrus
version:
d26492970760ca5d33129d2d799e34be5c4782eb
- name: github.com/
s
irupsen/logrus
version:
a3f95b5c423586578a4e099b11a46c2479628cac
- name: github.com/spf13/cobra
version: bc81c21bd0d8be5ba2d6630a505d79d4467566e7
- name: github.com/spf13/pflag
...
...
vendor/github.com/Sirupsen/logrus/terminal_windows.go
deleted
100644 → 0
View file @
4a88d064
// Based on ssh/terminal:
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows,!appengine
package
logrus
import
(
"syscall"
"unsafe"
)
var
kernel32
=
syscall
.
NewLazyDLL
(
"kernel32.dll"
)
var
(
procGetConsoleMode
=
kernel32
.
NewProc
(
"GetConsoleMode"
)
)
// IsTerminal returns true if stderr's file descriptor is a terminal.
func
IsTerminal
()
bool
{
fd
:=
syscall
.
Stderr
var
st
uint32
r
,
_
,
e
:=
syscall
.
Syscall
(
procGetConsoleMode
.
Addr
(),
2
,
uintptr
(
fd
),
uintptr
(
unsafe
.
Pointer
(
&
st
)),
0
)
return
r
!=
0
&&
e
==
0
}
vendor/github.com/
S
irupsen/logrus/LICENSE
→
vendor/github.com/
s
irupsen/logrus/LICENSE
View file @
d9778fda
File moved
vendor/github.com/
S
irupsen/logrus/alt_exit.go
→
vendor/github.com/
s
irupsen/logrus/alt_exit.go
View file @
d9778fda
package
logrus
// The following code was sourced and modified from the
// https://
bitbucket.org
/tebeka/atexit package governed by the following license:
// https://
github.com
/tebeka/atexit package governed by the following license:
//
// Copyright (c) 2012 Miki Tebeka <miki.tebeka@gmail.com>.
//
...
...
vendor/github.com/
S
irupsen/logrus/doc.go
→
vendor/github.com/
s
irupsen/logrus/doc.go
View file @
d9778fda
...
...
@@ -7,7 +7,7 @@ The simplest way to use Logrus is simply the package-level exported logger:
package main
import (
log "github.com/
S
irupsen/logrus"
log "github.com/
s
irupsen/logrus"
)
func main() {
...
...
@@ -21,6 +21,6 @@ The simplest way to use Logrus is simply the package-level exported logger:
Output:
time="2015-09-07T08:48:33Z" level=info msg="A walrus appears" animal=walrus number=1 size=10
For a full guide visit https://github.com/
S
irupsen/logrus
For a full guide visit https://github.com/
s
irupsen/logrus
*/
package
logrus
vendor/github.com/
S
irupsen/logrus/entry.go
→
vendor/github.com/
s
irupsen/logrus/entry.go
View file @
d9778fda
...
...
@@ -126,7 +126,7 @@ func (entry Entry) log(level Level, msg string) {
}
func
(
entry
*
Entry
)
Debug
(
args
...
interface
{})
{
if
entry
.
Logger
.
Level
>=
DebugLevel
{
if
entry
.
Logger
.
level
()
>=
DebugLevel
{
entry
.
log
(
DebugLevel
,
fmt
.
Sprint
(
args
...
))
}
}
...
...
@@ -136,13 +136,13 @@ func (entry *Entry) Print(args ...interface{}) {
}
func
(
entry
*
Entry
)
Info
(
args
...
interface
{})
{
if
entry
.
Logger
.
Level
>=
InfoLevel
{
if
entry
.
Logger
.
level
()
>=
InfoLevel
{
entry
.
log
(
InfoLevel
,
fmt
.
Sprint
(
args
...
))
}
}
func
(
entry
*
Entry
)
Warn
(
args
...
interface
{})
{
if
entry
.
Logger
.
Level
>=
WarnLevel
{
if
entry
.
Logger
.
level
()
>=
WarnLevel
{
entry
.
log
(
WarnLevel
,
fmt
.
Sprint
(
args
...
))
}
}
...
...
@@ -152,20 +152,20 @@ func (entry *Entry) Warning(args ...interface{}) {
}
func
(
entry
*
Entry
)
Error
(
args
...
interface
{})
{
if
entry
.
Logger
.
Level
>=
ErrorLevel
{
if
entry
.
Logger
.
level
()
>=
ErrorLevel
{
entry
.
log
(
ErrorLevel
,
fmt
.
Sprint
(
args
...
))
}
}
func
(
entry
*
Entry
)
Fatal
(
args
...
interface
{})
{
if
entry
.
Logger
.
Level
>=
FatalLevel
{
if
entry
.
Logger
.
level
()
>=
FatalLevel
{
entry
.
log
(
FatalLevel
,
fmt
.
Sprint
(
args
...
))
}
Exit
(
1
)
}
func
(
entry
*
Entry
)
Panic
(
args
...
interface
{})
{
if
entry
.
Logger
.
Level
>=
PanicLevel
{
if
entry
.
Logger
.
level
()
>=
PanicLevel
{
entry
.
log
(
PanicLevel
,
fmt
.
Sprint
(
args
...
))
}
panic
(
fmt
.
Sprint
(
args
...
))
...
...
@@ -174,13 +174,13 @@ func (entry *Entry) Panic(args ...interface{}) {
// Entry Printf family functions
func
(
entry
*
Entry
)
Debugf
(
format
string
,
args
...
interface
{})
{
if
entry
.
Logger
.
Level
>=
DebugLevel
{
if
entry
.
Logger
.
level
()
>=
DebugLevel
{
entry
.
Debug
(
fmt
.
Sprintf
(
format
,
args
...
))
}
}
func
(
entry
*
Entry
)
Infof
(
format
string
,
args
...
interface
{})
{
if
entry
.
Logger
.
Level
>=
InfoLevel
{
if
entry
.
Logger
.
level
()
>=
InfoLevel
{
entry
.
Info
(
fmt
.
Sprintf
(
format
,
args
...
))
}
}
...
...
@@ -190,7 +190,7 @@ func (entry *Entry) Printf(format string, args ...interface{}) {
}
func
(
entry
*
Entry
)
Warnf
(
format
string
,
args
...
interface
{})
{
if
entry
.
Logger
.
Level
>=
WarnLevel
{
if
entry
.
Logger
.
level
()
>=
WarnLevel
{
entry
.
Warn
(
fmt
.
Sprintf
(
format
,
args
...
))
}
}
...
...
@@ -200,20 +200,20 @@ func (entry *Entry) Warningf(format string, args ...interface{}) {
}
func
(
entry
*
Entry
)
Errorf
(
format
string
,
args
...
interface
{})
{
if
entry
.
Logger
.
Level
>=
ErrorLevel
{
if
entry
.
Logger
.
level
()
>=
ErrorLevel
{
entry
.
Error
(
fmt
.
Sprintf
(
format
,
args
...
))
}
}
func
(
entry
*
Entry
)
Fatalf
(
format
string
,
args
...
interface
{})
{
if
entry
.
Logger
.
Level
>=
FatalLevel
{
if
entry
.
Logger
.
level
()
>=
FatalLevel
{
entry
.
Fatal
(
fmt
.
Sprintf
(
format
,
args
...
))
}
Exit
(
1
)
}
func
(
entry
*
Entry
)
Panicf
(
format
string
,
args
...
interface
{})
{
if
entry
.
Logger
.
Level
>=
PanicLevel
{
if
entry
.
Logger
.
level
()
>=
PanicLevel
{
entry
.
Panic
(
fmt
.
Sprintf
(
format
,
args
...
))
}
}
...
...
@@ -221,13 +221,13 @@ func (entry *Entry) Panicf(format string, args ...interface{}) {
// Entry Println family functions
func
(
entry
*
Entry
)
Debugln
(
args
...
interface
{})
{
if
entry
.
Logger
.
Level
>=
DebugLevel
{
if
entry
.
Logger
.
level
()
>=
DebugLevel
{
entry
.
Debug
(
entry
.
sprintlnn
(
args
...
))
}
}
func
(
entry
*
Entry
)
Infoln
(
args
...
interface
{})
{
if
entry
.
Logger
.
Level
>=
InfoLevel
{
if
entry
.
Logger
.
level
()
>=
InfoLevel
{
entry
.
Info
(
entry
.
sprintlnn
(
args
...
))
}
}
...
...
@@ -237,7 +237,7 @@ func (entry *Entry) Println(args ...interface{}) {
}
func
(
entry
*
Entry
)
Warnln
(
args
...
interface
{})
{
if
entry
.
Logger
.
Level
>=
WarnLevel
{
if
entry
.
Logger
.
level
()
>=
WarnLevel
{
entry
.
Warn
(
entry
.
sprintlnn
(
args
...
))
}
}
...
...
@@ -247,20 +247,20 @@ func (entry *Entry) Warningln(args ...interface{}) {
}
func
(
entry
*
Entry
)
Errorln
(
args
...
interface
{})
{
if
entry
.
Logger
.
Level
>=
ErrorLevel
{
if
entry
.
Logger
.
level
()
>=
ErrorLevel
{
entry
.
Error
(
entry
.
sprintlnn
(
args
...
))
}
}
func
(
entry
*
Entry
)
Fatalln
(
args
...
interface
{})
{
if
entry
.
Logger
.
Level
>=
FatalLevel
{
if
entry
.
Logger
.
level
()
>=
FatalLevel
{
entry
.
Fatal
(
entry
.
sprintlnn
(
args
...
))
}
Exit
(
1
)
}
func
(
entry
*
Entry
)
Panicln
(
args
...
interface
{})
{
if
entry
.
Logger
.
Level
>=
PanicLevel
{
if
entry
.
Logger
.
level
()
>=
PanicLevel
{
entry
.
Panic
(
entry
.
sprintlnn
(
args
...
))
}
}
...
...
vendor/github.com/
S
irupsen/logrus/exported.go
→
vendor/github.com/
s
irupsen/logrus/exported.go
View file @
d9778fda
...
...
@@ -31,14 +31,14 @@ func SetFormatter(formatter Formatter) {
func
SetLevel
(
level
Level
)
{
std
.
mu
.
Lock
()
defer
std
.
mu
.
Unlock
()
std
.
Level
=
level
std
.
SetLevel
(
level
)
}
// GetLevel returns the standard logger level.
func
GetLevel
()
Level
{
std
.
mu
.
Lock
()
defer
std
.
mu
.
Unlock
()
return
std
.
Level
return
std
.
level
()
}
// AddHook adds a hook to the standard logger hooks.
...
...
vendor/github.com/
S
irupsen/logrus/formatter.go
→
vendor/github.com/
s
irupsen/logrus/formatter.go
View file @
d9778fda
File moved
vendor/github.com/
S
irupsen/logrus/hooks.go
→
vendor/github.com/
s
irupsen/logrus/hooks.go
View file @
d9778fda
File moved
vendor/github.com/
S
irupsen/logrus/json_formatter.go
→
vendor/github.com/
s
irupsen/logrus/json_formatter.go
View file @
d9778fda
...
...
@@ -5,9 +5,40 @@ import (
"fmt"
)
type
fieldKey
string
type
FieldMap
map
[
fieldKey
]
string
const
(
FieldKeyMsg
=
"msg"
FieldKeyLevel
=
"level"
FieldKeyTime
=
"time"
)
func
(
f
FieldMap
)
resolve
(
key
fieldKey
)
string
{
if
k
,
ok
:=
f
[
key
];
ok
{
return
k
}
return
string
(
key
)
}
type
JSONFormatter
struct
{
// TimestampFormat sets the format used for marshaling timestamps.
TimestampFormat
string
// DisableTimestamp allows disabling automatic timestamps in output
DisableTimestamp
bool
// FieldMap allows users to customize the names of keys for various fields.
// As an example:
// formatter := &JSONFormatter{
// FieldMap: FieldMap{
// FieldKeyTime: "@timestamp",
// FieldKeyLevel: "@level",
// FieldKeyMsg: "@message",
// },
// }
FieldMap
FieldMap
}
func
(
f
*
JSONFormatter
)
Format
(
entry
*
Entry
)
([]
byte
,
error
)
{
...
...
@@ -16,7 +47,7 @@ func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) {
switch
v
:=
v
.
(
type
)
{
case
error
:
// Otherwise errors are ignored by `encoding/json`
// https://github.com/
S
irupsen/logrus/issues/137
// https://github.com/
s
irupsen/logrus/issues/137
data
[
k
]
=
v
.
Error
()
default
:
data
[
k
]
=
v
...
...
@@ -29,9 +60,11 @@ func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) {
timestampFormat
=
DefaultTimestampFormat
}
data
[
"time"
]
=
entry
.
Time
.
Format
(
timestampFormat
)
data
[
"msg"
]
=
entry
.
Message
data
[
"level"
]
=
entry
.
Level
.
String
()
if
!
f
.
DisableTimestamp
{
data
[
f
.
FieldMap
.
resolve
(
FieldKeyTime
)]
=
entry
.
Time
.
Format
(
timestampFormat
)
}
data
[
f
.
FieldMap
.
resolve
(
FieldKeyMsg
)]
=
entry
.
Message
data
[
f
.
FieldMap
.
resolve
(
FieldKeyLevel
)]
=
entry
.
Level
.
String
()
serialized
,
err
:=
json
.
Marshal
(
data
)
if
err
!=
nil
{
...
...
vendor/github.com/
S
irupsen/logrus/logger.go
→
vendor/github.com/
s
irupsen/logrus/logger.go
View file @
d9778fda
...
...
@@ -4,6 +4,7 @@ import (
"io"
"os"
"sync"
"sync/atomic"
)
type
Logger
struct
{
...
...
@@ -112,7 +113,7 @@ func (logger *Logger) WithError(err error) *Entry {
}
func
(
logger
*
Logger
)
Debugf
(
format
string
,
args
...
interface
{})
{
if
logger
.
Level
>=
DebugLevel
{
if
logger
.
level
()
>=
DebugLevel
{
entry
:=
logger
.
newEntry
()
entry
.
Debugf
(
format
,
args
...
)
logger
.
releaseEntry
(
entry
)
...
...
@@ -120,7 +121,7 @@ func (logger *Logger) Debugf(format string, args ...interface{}) {
}
func
(
logger
*
Logger
)
Infof
(
format
string
,
args
...
interface
{})
{
if
logger
.
Level
>=
InfoLevel
{
if
logger
.
level
()
>=
InfoLevel
{
entry
:=
logger
.
newEntry
()
entry
.
Infof
(
format
,
args
...
)
logger
.
releaseEntry
(
entry
)
...
...
@@ -134,7 +135,7 @@ func (logger *Logger) Printf(format string, args ...interface{}) {
}
func
(
logger
*
Logger
)
Warnf
(
format
string
,
args
...
interface
{})
{
if
logger
.
Level
>=
WarnLevel
{
if
logger
.
level
()
>=
WarnLevel
{
entry
:=
logger
.
newEntry
()
entry
.
Warnf
(
format
,
args
...
)
logger
.
releaseEntry
(
entry
)
...
...
@@ -142,7 +143,7 @@ func (logger *Logger) Warnf(format string, args ...interface{}) {
}
func
(
logger
*
Logger
)
Warningf
(
format
string
,
args
...
interface
{})
{
if
logger
.
Level
>=
WarnLevel
{
if
logger
.
level
()
>=
WarnLevel
{
entry
:=
logger
.
newEntry
()
entry
.
Warnf
(
format
,
args
...
)
logger
.
releaseEntry
(
entry
)
...
...
@@ -150,7 +151,7 @@ func (logger *Logger) Warningf(format string, args ...interface{}) {
}
func
(
logger
*
Logger
)
Errorf
(
format
string
,
args
...
interface
{})
{
if
logger
.
Level
>=
ErrorLevel
{
if
logger
.
level
()
>=
ErrorLevel
{
entry
:=
logger
.
newEntry
()
entry
.
Errorf
(
format
,
args
...
)
logger
.
releaseEntry
(
entry
)
...
...
@@ -158,7 +159,7 @@ func (logger *Logger) Errorf(format string, args ...interface{}) {
}
func
(
logger
*
Logger
)
Fatalf
(
format
string
,
args
...
interface
{})
{
if
logger
.
Level
>=
FatalLevel
{
if
logger
.
level
()
>=
FatalLevel
{
entry
:=
logger
.
newEntry
()
entry
.
Fatalf
(
format
,
args
...
)
logger
.
releaseEntry
(
entry
)
...
...
@@ -167,7 +168,7 @@ func (logger *Logger) Fatalf(format string, args ...interface{}) {
}
func
(
logger
*
Logger
)
Panicf
(
format
string
,
args
...
interface
{})
{
if
logger
.
Level
>=
PanicLevel
{
if
logger
.
level
()
>=
PanicLevel
{
entry
:=
logger
.
newEntry
()
entry
.
Panicf
(
format
,
args
...
)
logger
.
releaseEntry
(
entry
)
...
...
@@ -175,7 +176,7 @@ func (logger *Logger) Panicf(format string, args ...interface{}) {
}
func
(
logger
*
Logger
)
Debug
(
args
...
interface
{})
{
if
logger
.
Level
>=
DebugLevel
{
if
logger
.
level
()
>=
DebugLevel
{
entry
:=
logger
.
newEntry
()
entry
.
Debug
(
args
...
)
logger
.
releaseEntry
(
entry
)
...
...
@@ -183,7 +184,7 @@ func (logger *Logger) Debug(args ...interface{}) {
}
func
(
logger
*
Logger
)
Info
(
args
...
interface
{})
{
if
logger
.
Level
>=
InfoLevel
{
if
logger
.
level
()
>=
InfoLevel
{
entry
:=
logger
.
newEntry
()
entry
.
Info
(
args
...
)
logger
.
releaseEntry
(
entry
)
...
...
@@ -197,7 +198,7 @@ func (logger *Logger) Print(args ...interface{}) {
}
func
(
logger
*
Logger
)
Warn
(
args
...
interface
{})
{
if
logger
.
Level
>=
WarnLevel
{
if
logger
.
level
()
>=
WarnLevel
{
entry
:=
logger
.
newEntry
()
entry
.
Warn
(
args
...
)
logger
.
releaseEntry
(
entry
)
...
...
@@ -205,7 +206,7 @@ func (logger *Logger) Warn(args ...interface{}) {
}
func
(
logger
*
Logger
)
Warning
(
args
...
interface
{})
{
if
logger
.
Level
>=
WarnLevel
{
if
logger
.
level
()
>=
WarnLevel
{
entry
:=
logger
.
newEntry
()
entry
.
Warn
(
args
...
)
logger
.
releaseEntry
(
entry
)
...
...
@@ -213,7 +214,7 @@ func (logger *Logger) Warning(args ...interface{}) {
}
func
(
logger
*
Logger
)
Error
(
args
...
interface
{})
{
if
logger
.
Level
>=
ErrorLevel
{
if
logger
.
level
()
>=
ErrorLevel
{
entry
:=
logger
.
newEntry
()
entry
.
Error
(
args
...
)
logger
.
releaseEntry
(
entry
)
...
...
@@ -221,7 +222,7 @@ func (logger *Logger) Error(args ...interface{}) {
}
func
(
logger
*
Logger
)
Fatal
(
args
...
interface
{})
{
if
logger
.
Level
>=
FatalLevel
{
if
logger
.
level
()
>=
FatalLevel
{
entry
:=
logger
.
newEntry
()
entry
.
Fatal
(
args
...
)
logger
.
releaseEntry
(
entry
)
...
...
@@ -230,7 +231,7 @@ func (logger *Logger) Fatal(args ...interface{}) {
}
func
(
logger
*
Logger
)
Panic
(
args
...
interface
{})
{
if
logger
.
Level
>=
PanicLevel
{
if
logger
.
level
()
>=
PanicLevel
{
entry
:=
logger
.
newEntry
()
entry
.
Panic
(
args
...
)
logger
.
releaseEntry
(
entry
)
...
...
@@ -238,7 +239,7 @@ func (logger *Logger) Panic(args ...interface{}) {
}
func
(
logger
*
Logger
)
Debugln
(
args
...
interface
{})
{
if
logger
.
Level
>=
DebugLevel
{
if
logger
.
level
()
>=
DebugLevel
{
entry
:=
logger
.
newEntry
()
entry
.
Debugln
(
args
...
)
logger
.
releaseEntry
(
entry
)
...
...
@@ -246,7 +247,7 @@ func (logger *Logger) Debugln(args ...interface{}) {
}
func
(
logger
*
Logger
)
Infoln
(
args
...
interface
{})
{
if
logger
.
Level
>=
InfoLevel
{
if
logger
.
level
()
>=
InfoLevel
{
entry
:=
logger
.
newEntry
()
entry
.
Infoln
(
args
...
)
logger
.
releaseEntry
(
entry
)
...
...
@@ -260,7 +261,7 @@ func (logger *Logger) Println(args ...interface{}) {
}
func
(
logger
*
Logger
)
Warnln
(
args
...
interface
{})
{
if
logger
.
Level
>=
WarnLevel
{
if
logger
.
level
()
>=
WarnLevel
{
entry
:=
logger
.
newEntry
()
entry
.
Warnln
(
args
...
)
logger
.
releaseEntry
(
entry
)
...
...
@@ -268,7 +269,7 @@ func (logger *Logger) Warnln(args ...interface{}) {
}
func
(
logger
*
Logger
)
Warningln
(
args
...
interface
{})
{
if
logger
.
Level
>=
WarnLevel
{
if
logger
.
level
()
>=
WarnLevel
{
entry
:=
logger
.
newEntry
()
entry
.
Warnln
(
args
...
)
logger
.
releaseEntry
(
entry
)
...
...
@@ -276,7 +277,7 @@ func (logger *Logger) Warningln(args ...interface{}) {
}
func
(
logger
*
Logger
)
Errorln
(
args
...
interface
{})
{
if
logger
.
Level
>=
ErrorLevel
{
if
logger
.
level
()
>=
ErrorLevel
{
entry
:=
logger
.
newEntry
()
entry
.
Errorln
(
args
...
)
logger
.
releaseEntry
(
entry
)
...
...
@@ -284,7 +285,7 @@ func (logger *Logger) Errorln(args ...interface{}) {
}
func
(
logger
*
Logger
)
Fatalln
(
args
...
interface
{})
{
if
logger
.
Level
>=
FatalLevel
{
if
logger
.
level
()
>=
FatalLevel
{
entry
:=
logger
.
newEntry
()
entry
.
Fatalln
(
args
...
)
logger
.
releaseEntry
(
entry
)
...
...
@@ -293,7 +294,7 @@ func (logger *Logger) Fatalln(args ...interface{}) {
}
func
(
logger
*
Logger
)
Panicln
(
args
...
interface
{})
{
if
logger
.
Level
>=
PanicLevel
{
if
logger
.
level
()
>=
PanicLevel
{
entry
:=
logger
.
newEntry
()
entry
.
Panicln
(
args
...
)
logger
.
releaseEntry
(
entry
)
...
...
@@ -306,3 +307,11 @@ func (logger *Logger) Panicln(args ...interface{}) {
func
(
logger
*
Logger
)
SetNoLock
()
{
logger
.
mu
.
Disable
()
}
func
(
logger
*
Logger
)
level
()
Level
{
return
Level
(
atomic
.
LoadUint32
((
*
uint32
)(
&
logger
.
Level
)))
}
func
(
logger
*
Logger
)
SetLevel
(
level
Level
)
{
atomic
.
StoreUint32
((
*
uint32
)(
&
logger
.
Level
),
uint32
(
level
))
}
vendor/github.com/
S
irupsen/logrus/logrus.go
→
vendor/github.com/
s
irupsen/logrus/logrus.go
View file @
d9778fda
...
...
@@ -10,7 +10,7 @@ import (
type
Fields
map
[
string
]
interface
{}
// Level type
type
Level
uint
8
type
Level
uint
32
// Convert the Level to a string. E.g. PanicLevel becomes "panic".
func
(
level
Level
)
String
()
string
{
...
...
vendor/github.com/
S
irupsen/logrus/terminal_appengine.go
→
vendor/github.com/
s
irupsen/logrus/terminal_appengine.go
View file @
d9778fda
...
...
@@ -2,7 +2,9 @@
package
logrus
import
"io"
// IsTerminal returns true if stderr's file descriptor is a terminal.
func
IsTerminal
()
bool
{
func
IsTerminal
(
f
io
.
Writer
)
bool
{
return
true
}
vendor/github.com/
S
irupsen/logrus/terminal_bsd.go
→
vendor/github.com/
s
irupsen/logrus/terminal_bsd.go
View file @
d9778fda
File moved
vendor/github.com/
S
irupsen/logrus/terminal_linux.go
→
vendor/github.com/
s
irupsen/logrus/terminal_linux.go
View file @
d9778fda
File moved
vendor/github.com/
S
irupsen/logrus/terminal_notwindows.go
→
vendor/github.com/
s
irupsen/logrus/terminal_notwindows.go
View file @
d9778fda
...
...
@@ -9,14 +9,20 @@
package
logrus
import
(
"io"
"os"
"syscall"
"unsafe"
)
// IsTerminal returns true if stderr's file descriptor is a terminal.
func
IsTerminal
()
bool
{
fd
:=
syscall
.
Stderr
func
IsTerminal
(
f
io
.
Writer
)
bool
{
var
termios
Termios
_
,
_
,
err
:=
syscall
.
Syscall6
(
syscall
.
SYS_IOCTL
,
uintptr
(
fd
),
ioctlReadTermios
,
uintptr
(
unsafe
.
Pointer
(
&
termios
)),
0
,
0
,
0
)
return
err
==
0
switch
v
:=
f
.
(
type
)
{
case
*
os
.
File
:
_
,
_
,
err
:=
syscall
.
Syscall6
(
syscall
.
SYS_IOCTL
,
uintptr
(
v
.
Fd
()),
ioctlReadTermios
,
uintptr
(
unsafe
.
Pointer
(
&
termios
)),
0
,
0
,
0
)
return
err
==
0
default
:
return
false
}
}
vendor/github.com/
S
irupsen/logrus/terminal_solaris.go
→
vendor/github.com/
s
irupsen/logrus/terminal_solaris.go
View file @
d9778fda
...
...
@@ -3,13 +3,19 @@
package
logrus
import
(
"io"
"os"
"golang.org/x/sys/unix"
)
// IsTerminal returns true if the given file descriptor is a terminal.
func
IsTerminal
()
bool
{
_
,
err
:=
unix
.
IoctlGetTermios
(
int
(
os
.
Stdout
.
Fd
()),
unix
.
TCGETA
)
return
err
==
nil
func
IsTerminal
(
f
io
.
Writer
)
bool
{
switch
v
:=
f
.
(
type
)
{
case
*
os
.
File
:
_
,
err
:=
unix
.
IoctlGetTermios
(
int
(
v
.
Fd
()),
unix
.
TCGETA
)
return
err
==
nil
default
:
return
false
}
}
vendor/github.com/sirupsen/logrus/terminal_windows.go
0 → 100644
View file @
d9778fda
// Based on ssh/terminal:
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows,!appengine
package
logrus
import
(
"bytes"
"errors"
"io"
"os"
"os/exec"
"strconv"
"strings"
"syscall"
"unsafe"
)
var
kernel32
=
syscall
.
NewLazyDLL
(
"kernel32.dll"
)
var
(
procGetConsoleMode
=
kernel32
.
NewProc
(
"GetConsoleMode"
)
procSetConsoleMode
=
kernel32
.
NewProc
(
"SetConsoleMode"
)
)
const
(
enableProcessedOutput
=
0x0001
enableWrapAtEolOutput
=
0x0002
enableVirtualTerminalProcessing
=
0x0004
)
func
getVersion
()
(
float64
,
error
)
{
stdout
,
stderr
:=
&
bytes
.
Buffer
{},
&
bytes
.
Buffer
{}
cmd
:=
exec
.
Command
(
"cmd"
,
"ver"
)
cmd
.
Stdout
=
stdout
cmd
.
Stderr
=
stderr
err
:=
cmd
.
Run
()
if
err
!=
nil
{
return
-
1
,
err
}
// The output should be like "Microsoft Windows [Version XX.X.XXXXXX]"
version
:=
strings
.
Replace
(
stdout
.
String
(),
"
\n
"
,
""
,
-
1
)
version
=
strings
.
Replace
(
version
,
"
\r\n
"
,
""
,
-
1
)
x1
:=
strings
.
Index
(
version
,
"[Version"
)
if
x1
==
-
1
||
strings
.
Index
(
version
,
"]"
)
==
-
1
{
return
-
1
,
errors
.
New
(
"Can't determine Windows version"
)
}
return
strconv
.
ParseFloat
(
version
[
x1
+
9
:
x1
+
13
],
64
)
}
func
init
()
{
ver
,
err
:=
getVersion
()
if
err
!=
nil
{
return
}
// Activate Virtual Processing for Windows CMD
// Info: https://msdn.microsoft.com/en-us/library/windows/desktop/ms686033(v=vs.85).aspx
if
ver
>=
10
{
handle
:=
syscall
.
Handle
(
os
.
Stderr
.
Fd
())
procSetConsoleMode
.
Call
(
uintptr
(
handle
),
enableProcessedOutput
|
enableWrapAtEolOutput
|
enableVirtualTerminalProcessing
)
}
}
// IsTerminal returns true if stderr's file descriptor is a terminal.
func
IsTerminal
(
f
io
.
Writer
)
bool
{
switch
v
:=
f
.
(
type
)
{
case
*
os
.
File
:
var
st
uint32
r
,
_
,
e
:=
syscall
.
Syscall
(
procGetConsoleMode
.
Addr
(),
2
,
uintptr
(
v
.
Fd
()),
uintptr
(
unsafe
.
Pointer
(
&
st
)),
0
)
return
r
!=
0
&&
e
==
0
default
:
return
false
}
}
vendor/github.com/
S
irupsen/logrus/text_formatter.go
→
vendor/github.com/
s
irupsen/logrus/text_formatter.go
View file @
d9778fda
...
...
@@ -3,9 +3,9 @@ package logrus
import
(
"bytes"
"fmt"
"runtime"
"sort"
"strings"
"sync"
"time"
)
...
...
@@ -14,22 +14,16 @@ const (
red
=
31
green
=
32
yellow
=
33
blue
=
3
4
blue
=
3
6
gray
=
37
)
var
(
baseTimestamp
time
.
Time
isTerminal
bool
)
func
init
()
{
baseTimestamp
=
time
.
Now
()
isTerminal
=
IsTerminal
()
}
func
miniTS
()
int
{
return
int
(
time
.
Since
(
baseTimestamp
)
/
time
.
Second
)
}
type
TextFormatter
struct
{
...
...
@@ -54,11 +48,32 @@ type TextFormatter struct {
// that log extremely frequently and don't use the JSON formatter this may not
// be desired.
DisableSorting
bool
// QuoteEmptyFields will wrap empty fields in quotes if true
QuoteEmptyFields
bool
// QuoteCharacter can be set to the override the default quoting character "
// with something else. For example: ', or `.
QuoteCharacter
string
// Whether the logger's out is to a terminal
isTerminal
bool
sync
.
Once
}
func
(
f
*
TextFormatter
)
init
(
entry
*
Entry
)
{
if
len
(
f
.
QuoteCharacter
)
==
0
{
f
.
QuoteCharacter
=
"
\"
"
}
if
entry
.
Logger
!=
nil
{
f
.
isTerminal
=
IsTerminal
(
entry
.
Logger
.
Out
)
}
}
func
(
f
*
TextFormatter
)
Format
(
entry
*
Entry
)
([]
byte
,
error
)
{
var
b
*
bytes
.
Buffer
var
keys
[]
string
=
make
([]
string
,
0
,
len
(
entry
.
Data
))
keys
:
=
make
([]
string
,
0
,
len
(
entry
.
Data
))
for
k
:=
range
entry
.
Data
{
keys
=
append
(
keys
,
k
)
}
...
...
@@ -74,8 +89,9 @@ func (f *TextFormatter) Format(entry *Entry) ([]byte, error) {
prefixFieldClashes
(
entry
.
Data
)
isColorTerminal
:=
isTerminal
&&
(
runtime
.
GOOS
!=
"windows"
)
isColored
:=
(
f
.
ForceColors
||
isColorTerminal
)
&&
!
f
.
DisableColors
f
.
Do
(
func
()
{
f
.
init
(
entry
)
})
isColored
:=
(
f
.
ForceColors
||
f
.
isTerminal
)
&&
!
f
.
DisableColors
timestampFormat
:=
f
.
TimestampFormat
if
timestampFormat
==
""
{
...
...
@@ -115,8 +131,10 @@ func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []strin
levelText
:=
strings
.
ToUpper
(
entry
.
Level
.
String
())[
0
:
4
]
if
!
f
.
FullTimestamp
{
fmt
.
Fprintf
(
b
,
"
\x1b
[%dm%s
\x1b
[0m[%04d] %-44s "
,
levelColor
,
levelText
,
miniTS
(),
entry
.
Message
)
if
f
.
DisableTimestamp
{
fmt
.
Fprintf
(
b
,
"
\x1b
[%dm%s
\x1b
[0m %-44s "
,
levelColor
,
levelText
,
entry
.
Message
)
}
else
if
!
f
.
FullTimestamp
{
fmt
.
Fprintf
(
b
,
"
\x1b
[%dm%s
\x1b
[0m[%04d] %-44s "
,
levelColor
,
levelText
,
int
(
entry
.
Time
.
Sub
(
baseTimestamp
)
/
time
.
Second
),
entry
.
Message
)
}
else
{
fmt
.
Fprintf
(
b
,
"
\x1b
[%dm%s
\x1b
[0m[%s] %-44s "
,
levelColor
,
levelText
,
entry
.
Time
.
Format
(
timestampFormat
),
entry
.
Message
)
}
...
...
@@ -127,12 +145,15 @@ func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []strin
}
}
func
needsQuoting
(
text
string
)
bool
{
func
(
f
*
TextFormatter
)
needsQuoting
(
text
string
)
bool
{
if
f
.
QuoteEmptyFields
&&
len
(
text
)
==
0
{
return
true
}
for
_
,
ch
:=
range
text
{
if
!
((
ch
>=
'a'
&&
ch
<=
'z'
)
||
(
ch
>=
'A'
&&
ch
<=
'Z'
)
||
(
ch
>=
'0'
&&
ch
<=
'9'
)
||
ch
==
'-'
||
ch
==
'.'
)
{
ch
==
'-'
||
ch
==
'.'
||
ch
==
'_'
||
ch
==
'/'
||
ch
==
'@'
||
ch
==
'^'
||
ch
==
'+'
)
{
return
true
}
}
...
...
@@ -148,21 +169,21 @@ func (f *TextFormatter) appendKeyValue(b *bytes.Buffer, key string, value interf
}
func
(
f
*
TextFormatter
)
appendValue
(
b
*
bytes
.
Buffer
,
value
interface
{})
{
switch
value
:=
value
.
(
type
)
{
case
string
:
if
!
needsQuoting
(
value
)
{
b
.
WriteString
(
value
)
}
else
{
fmt
.
Fprintf
(
b
,
"%q"
,
value
)
}
case
error
:
errmsg
:=
value
.
Error
()
if
!
needsQuoting
(
errmsg
)
{
b
.
WriteString
(
errmsg
)
}
else
{
fmt
.
Fprintf
(
b
,
"%q"
,
errmsg
)
}
default
:
fmt
.
Fprint
(
b
,
value
)
stringVal
,
ok
:=
value
.
(
string
)
if
!
ok
{
stringVal
=
fmt
.
Sprint
(
value
)
}
if
!
f
.
needsQuoting
(
stringVal
)
{
b
.
WriteString
(
stringVal
)
}
else
{
b
.
WriteString
(
f
.
quoteString
(
stringVal
))
}
}
func
(
f
*
TextFormatter
)
quoteString
(
v
string
)
string
{
escapedQuote
:=
fmt
.
Sprintf
(
"
\\
%s"
,
f
.
QuoteCharacter
)
escapedValue
:=
strings
.
Replace
(
v
,
f
.
QuoteCharacter
,
escapedQuote
,
-
1
)
return
fmt
.
Sprintf
(
"%s%v%s"
,
f
.
QuoteCharacter
,
escapedValue
,
f
.
QuoteCharacter
)
}
vendor/github.com/
S
irupsen/logrus/writer.go
→
vendor/github.com/
s
irupsen/logrus/writer.go
View file @
d9778fda
...
...
@@ -11,39 +11,48 @@ func (logger *Logger) Writer() *io.PipeWriter {
}
func
(
logger
*
Logger
)
WriterLevel
(
level
Level
)
*
io
.
PipeWriter
{
return
NewEntry
(
logger
)
.
WriterLevel
(
level
)
}
func
(
entry
*
Entry
)
Writer
()
*
io
.
PipeWriter
{
return
entry
.
WriterLevel
(
InfoLevel
)
}
func
(
entry
*
Entry
)
WriterLevel
(
level
Level
)
*
io
.
PipeWriter
{
reader
,
writer
:=
io
.
Pipe
()
var
printFunc
func
(
args
...
interface
{})
switch
level
{
case
DebugLevel
:
printFunc
=
logger
.
Debug
printFunc
=
entry
.
Debug
case
InfoLevel
:
printFunc
=
logger
.
Info
printFunc
=
entry
.
Info
case
WarnLevel
:
printFunc
=
logger
.
Warn
printFunc
=
entry
.
Warn
case
ErrorLevel
:
printFunc
=
logger
.
Error
printFunc
=
entry
.
Error
case
FatalLevel
:
printFunc
=
logger
.
Fatal
printFunc
=
entry
.
Fatal
case
PanicLevel
:
printFunc
=
logger
.
Panic
printFunc
=
entry
.
Panic
default
:
printFunc
=
logger
.
Print
printFunc
=
entry
.
Print
}
go
logger
.
writerScanner
(
reader
,
printFunc
)
go
entry
.
writerScanner
(
reader
,
printFunc
)
runtime
.
SetFinalizer
(
writer
,
writerFinalizer
)
return
writer
}
func
(
logger
*
Logger
)
writerScanner
(
reader
*
io
.
PipeReader
,
printFunc
func
(
args
...
interface
{}))
{
func
(
entry
*
Entry
)
writerScanner
(
reader
*
io
.
PipeReader
,
printFunc
func
(
args
...
interface
{}))
{
scanner
:=
bufio
.
NewScanner
(
reader
)
for
scanner
.
Scan
()
{
printFunc
(
scanner
.
Text
())
}
if
err
:=
scanner
.
Err
();
err
!=
nil
{
logger
.
Errorf
(
"Error while reading from Writer: %s"
,
err
)
entry
.
Errorf
(
"Error while reading from Writer: %s"
,
err
)
}
reader
.
Close
()
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment