示例#1
0
func newSawmill(name string) *Sawmill {
	smlog.Trace()
	defer smlog.Untrace()
	smlog.DebugVar("name", name)

	return &Sawmill{
		name:     name,
		buffered: true,
		buffer:   stringbuffer.NewStringBuffer(),
		outputs:  []io.WriteCloser{os.Stdout},
	}
}
示例#2
0
const VERSION = "v0.1"

type Sawmill struct {
	name     string
	buffered bool
	buffer   *stringbuffer.StringBuffer
	outputs  []io.WriteCloser
	indent   int
	debug    bool
}

var sawmills = make(map[string]*Sawmill)
var smlog = &Sawmill{
	name:     "sawmill",
	buffered: true,
	buffer:   stringbuffer.NewStringBuffer(),
	outputs:  []io.WriteCloser{os.Stdout},
}

func init() {
	sawmills["root"] = newSawmill(path.Base(os.Args[0]))
	sawmills["_sawmill"] = smlog
	if DEBUG {
		smlog.DebugOn()
	}
	smlog.Debug("Sawmill library", VERSION)
}

func RootSawmill() *Sawmill {
	smlog.Trace()
	defer smlog.Untrace()