code cleanup

This commit is contained in:
Simon Eskildsen
2014-02-23 19:53:50 -05:00
parent 6c895096e8
commit 0bd36d372c
2 changed files with 11 additions and 22 deletions
+2 -18
View File
@@ -3,10 +3,7 @@ package logrus
import (
"io"
"os"
"strings"
"sync"
"github.com/tobi/airbrake-go"
)
type Logger struct {
@@ -15,30 +12,17 @@ type Logger struct {
}
func New() *Logger {
environment := strings.ToLower(os.Getenv("ENV"))
if environment == "" {
environment = "development"
}
if airbrake.Environment == "" {
airbrake.Environment = environment
}
return &Logger{
Out: os.Stdout, // Default to stdout, change it if you want.
}
}
func (logger *Logger) WithField(key string, value interface{}) *Entry {
entry := NewEntry(logger)
entry.WithField(key, value)
return entry
return NewEntry(logger).WithField(key, value)
}
func (logger *Logger) WithFields(fields Fields) *Entry {
entry := NewEntry(logger)
entry.WithFields(fields)
return entry
return NewEntry(logger).WithFields(fields)
}
// Entry Print family functions