-
Notifications
You must be signed in to change notification settings - Fork 712
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alfonso Acosta
committed
Feb 5, 2016
1 parent
00cd193
commit 12b633f
Showing
23 changed files
with
172 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package log | ||
|
||
// Logger for Scope piggi-backing on github.com/weaveworks/weave/common.Log | ||
|
||
import ( | ||
"github.com/Sirupsen/logrus" | ||
|
||
weavecommon "github.com/weaveworks/weave/common" | ||
) | ||
|
||
var ( | ||
prefix []byte | ||
Log *logrus.Logger | ||
) | ||
|
||
type prefixFormatter struct { | ||
next logrus.Formatter | ||
} | ||
|
||
func (f *prefixFormatter) Format(entry *logrus.Entry) ([]byte, error) { | ||
log, err := f.next.Format(entry) | ||
if err != nil { | ||
return log, err | ||
} | ||
return append(prefix, log...), nil | ||
} | ||
|
||
func init() { | ||
Log = weavecommon.Log | ||
Log.Formatter = &prefixFormatter{Log.Formatter} | ||
} | ||
|
||
func SetLogLevel(levelname string) { | ||
weavecommon.SetLogLevel(levelname) | ||
} | ||
|
||
func SetLogPrefix(s string) { | ||
prefix = []byte(s) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.