12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- package sizer
- import "log"
- // Debug is a global bool to toggle debugging messages.
- var Debug bool
- type console log.Logger
- func (l *console) SetFlags(i int) {
- log.SetFlags(i)
- }
- func (l *console) Print(v ...interface{}) {
- log.Print(v...)
- }
- func (l *console) Printf(format string, v ...interface{}) {
- log.Printf(format, v...)
- }
- func (l *console) Println(v ...interface{}) {
- log.Println(v...)
- }
- func (l *console) Fatal(v ...interface{}) {
- log.Fatal(v...)
- }
- func (l *console) Fatalf(format string, v ...interface{}) {
- log.Fatalf(format, v...)
- }
- func (l *console) Fatalln(v ...interface{}) {
- log.Fatalln(v...)
- }
- func (l *console) Debug(msg ...interface{}) {
- if Debug {
- l.Print(msg...)
- }
- }
- func (l *console) Debugf(format string, msg ...interface{}) {
- if Debug {
- l.Printf(format, msg...)
- }
- }
- func (l *console) Debugln(msg ...interface{}) {
- if Debug {
- l.Println(msg...)
- }
- }
- // Console is the logger object
- var Console console
- func init() {
- Console.SetFlags(0)
- }
|