Example #1
0
func (l *logWriter) LogWrite(rec *log4go.LogRecord) {
	p := Prof.Enter("log")
	defer p.Exit()
	l.lock.Lock()
	defer l.lock.Unlock()
	fl := log4go.FormatLogRecord(log4go.FORMAT_DEFAULT, rec)
	l.log <- fl
}
Example #2
0
func NewSysLogWriter(priority syslog.Priority) (w sysLogWriter, err error) {
	writer, err := connectSyslogDaemon(priority)
	if err != nil {
		return
	}
	w = sysLogWriter(make(chan *log.LogRecord, log.LogBufferLength))
	go func() {
		defer func() {
			if w != nil {
				w.Close()
			}
		}()
		for rec := range w {
			m := log.FormatLogRecord("(%S) %M", rec)
			getWriter(writer, rec.Level.String())(m)
		}
	}()
	return
}
Example #3
0
func (m *myLogWriter) LogWrite(rec *log4go.LogRecord) {
	p := Prof.Enter("log")
	defer p.Exit()
	fl := log4go.FormatLogRecord(log4go.FORMAT_DEFAULT, rec)
	m.log <- fl
}
Example #4
0
func (t *testlogger) LogWrite(rec *log4go.LogRecord) {
	t.t.Log(strings.TrimSpace(log4go.FormatLogRecord(log4go.FORMAT_DEFAULT, rec)))
}