1
0
mirror of https://github.com/volatiletech/authboss.git synced 2024-12-10 10:40:07 +02:00
authboss/logger.go
Aaron bd0d3c5f68 Add a default logger.
- Having the default logger set to nil was troublesome because some errors
  are hard to detect without a logger. This falls under "sane default"
  changes and so should be made.
2015-03-30 09:55:37 -07:00

21 lines
421 B
Go

package authboss
import (
"log"
"os"
)
// DefaultLogger is a basic logger.
type DefaultLogger log.Logger
// NewDefaultLogger creates a logger to stdout.
func NewDefaultLogger() *DefaultLogger {
return ((*DefaultLogger)(log.New(os.Stdout, "", log.LstdFlags)))
}
// Write writes to the internal logger.
func (d *DefaultLogger) Write(b []byte) (int, error) {
((*log.Logger)(d)).Printf("%s", b)
return len(b), nil
}