Example #1
0
func (fa *fileAppender) Append(event *Event) (ok bool) {
	ok = false
	defer gorivets.EndQuietly()
	msg := ToLogMessage(event, fa.layoutTemplate)
	fa.msgChannel <- msg
	ok = true
	return ok
}
Example #2
0
// Appender interface implementation
func (cAppender *consoleAppender) Append(event *Event) (ok bool) {
	ok = false
	defer gorivets.EndQuietly()
	msg := ToLogMessage(event, cAppender.layoutTemplate)
	caFactory.msgChannel <- msg
	ok = true
	return ok
}
Example #3
0
func (lc *logConfig) cleanUp() {
	defer gorivets.EndQuietly()

	for _, ctx := range lc.logContexts.Copy() {
		ctx.(*logContext).shutdown()
	}

	for _, app := range lc.appenders {
		app.Shutdown()
	}
}
Example #4
0
// log() function sends the logEvent to all the logContext appenders.
// It returns true if the logEvent was sent and false if the context is shut down or
// the context is non-blocking (allows to lost log messages in case of overflow)
func (lc *logContext) log(le *Event) (result bool) {
	// Channel can be already closed, so end quietly
	result = false
	defer gorivets.EndQuietly()

	if lc.blocking {
		lc.eventsCh <- le
		return true
	}

	select {
	case lc.eventsCh <- le:
		return true
	default:
	}
	return false
}