Skip to content

Commit

Permalink
Merge pull request #6 from davecheney/002-drop-loggo-dependency
Browse files Browse the repository at this point in the history
Remove dependency on github.com/juju/loggo
  • Loading branch information
davecheney committed May 21, 2014
2 parents f6b8bbf + f47298c commit 26caa7d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 30 deletions.
21 changes: 6 additions & 15 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,12 @@ package errgo
import (
"bytes"
"fmt"
"log"
"runtime"

"github.com/juju/loggo"
)

const debug = false

var logger loggo.Logger

func init() {
if debug {
logger = loggo.GetLogger("juju.errgo.errors")
}
}

// Location describes a source code location.
type Location struct {
File string
Expand Down Expand Up @@ -263,11 +254,11 @@ func NoteMask(underlying error, msg string, pass ...func(error) bool) error {
}
if debug {
if newd, oldd := newErr.Cause_, Cause(underlying); newd != oldd {
logger.Infof("Mask cause %[1]T(%[1]v)->%[2]T(%[2]v)", oldd, newd)
logger.Infof("call stack: %s", callers(0, 20))
logger.Infof("len(allow) == %d", len(pass))
logger.Infof("old error %#v", underlying)
logger.Infof("new error %#v", newErr)
log.Printf("Mask cause %[1]T(%[1]v)->%[2]T(%[2]v)", oldd, newd)
log.Printf("call stack: %s", callers(0, 20))
log.Printf("len(allow) == %d", len(pass))
log.Printf("old error %#v", underlying)
log.Printf("new error %#v", newErr)
}
}
return newErr
Expand Down
21 changes: 6 additions & 15 deletions errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,12 @@ package errors
import (
"bytes"
"fmt"
"log"
"runtime"

"github.com/juju/loggo"
)

const debug = false

var logger loggo.Logger

func init() {
if debug {
logger = loggo.GetLogger("juju.errgo.errors")
}
}

// Location describes a source code location.
type Location struct {
File string
Expand Down Expand Up @@ -267,11 +258,11 @@ func NoteMask(underlying error, msg string, pass ...func(error) bool) error {
}
if debug {
if newd, oldd := newErr.Cause_, Cause(underlying); newd != oldd {
logger.Infof("Mask cause %[1]T(%[1]v)->%[2]T(%[2]v)", oldd, newd)
logger.Infof("call stack: %s", callers(0, 20))
logger.Infof("len(allow) == %d", len(pass))
logger.Infof("old error %#v", underlying)
logger.Infof("new error %#v", newErr)
log.Printf("Mask cause %[1]T(%[1]v)->%[2]T(%[2]v)", oldd, newd)
log.Printf("call stack: %s", callers(0, 20))
log.Printf("len(allow) == %d", len(pass))
log.Printf("old error %#v", underlying)
log.Printf("new error %#v", newErr)
}
}
return newErr
Expand Down

0 comments on commit 26caa7d

Please sign in to comment.