func init() { var err error if log, err = logging.SimpleLogger("goa"); err != nil { panic(err) } }
func main() { logger1, _ := logging.SimpleLogger("logger1") logger1.SetLevel(logging.NOTSET) logger1.Error("this is a test from error") logger1.Debug("this is a test from debug") logger1.Notset("orz", time.Now().UnixNano()) logger1.Destroy() logger2, _ := logging.RichLogger("logger2") logger2.SetLevel(logging.DEBUG) logger2.Error("this is a test from error") logger2.Debug("this is a test from debug") logger2.Notset("orz", time.Now().UnixNano()) logger2.Destroy() logger3, _ := logging.ConfigLogger("example.conf") logger3.SetLevel(logging.DEBUG) logger3.Error("this is a test from error") logger3.Debug("this is a test from debug") logger3.Notset("orz", time.Now().UnixNano()) logger3.Destroy() }
package etcd import ( "github.com/ccding/go-logging/logging" ) var logger, _ = logging.SimpleLogger("go-etcd") func init() { logger.SetLevel(logging.FATAL) } func OpenDebug() { logger.SetLevel(logging.NOTSET) } func CloseDebug() { logger.SetLevel(logging.FATAL) }