Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
name5566 committed Dec 19, 2016
1 parent abf9052 commit 95ff6f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion log/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func Example() {
log.Error("My name is %v", name)
// log.Fatal("My name is %v", name)

logger, err := log.New("release", "")
logger, err := log.New("release", "", 0)
if err != nil {
return
}
Expand Down
8 changes: 4 additions & 4 deletions log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type Logger struct {
baseFile *os.File
}

func New(strLevel string, pathname string) (*Logger, error) {
func New(strLevel string, pathname string, flag int) (*Logger, error) {
// level
var level int
switch strings.ToLower(strLevel) {
Expand Down Expand Up @@ -66,10 +66,10 @@ func New(strLevel string, pathname string) (*Logger, error) {
return nil, err
}

baseLogger = log.New(file, "", log.LstdFlags)
baseLogger = log.New(file, "", flag)
baseFile = file
} else {
baseLogger = log.New(os.Stdout, "", log.LstdFlags)
baseLogger = log.New(os.Stdout, "", flag)
}

// new
Expand Down Expand Up @@ -123,7 +123,7 @@ func (logger *Logger) Fatal(format string, a ...interface{}) {
logger.doPrintf(fatalLevel, printFatalLevel, format, a...)
}

var gLogger, _ = New("debug", "")
var gLogger, _ = New("debug", "", log.LstdFlags)

// It's dangerous to call the method on logging
func Export(logger *Logger) {
Expand Down

0 comments on commit 95ff6f7

Please sign in to comment.