//listen will listen for log messages and write them
listen will listen for log messages and write them
// listen will listen for log messages and write them
func (log *DatabaseLog) listen() {
	err := log.db.Start()
	if err != nil {
		log.err <- fmt.Errorf("could start database log: %v", err)
		return
	}
	log.err <- nil
	for {
		msg, ok := <-log.io
		if !ok {
			break
		}
		if (uint8(log.level) & uint8(msg.level)) > 0 {
			log.db.Write(msg.level, msg.message)
		}
	}
	err = log.db.Close()
	if err != nil {
		log.err <- fmt.Errorf("could not close database log: %v", err)
		return
	}
	log.err <- nil
}
func ( log * DatabaseLog ) listen ( ) { err := log . db . Start ( ) if err != nil { log . err <- fmt . Errorf ( " " , err ) return } log . err <- nil for { msg , ok := <- log . io if ! ok { break } if ( uint8 ( log . level ) & uint8 ( msg . level ) ) > 0 { log . db . Write ( msg . level , msg . message ) } } err = log . db . Close ( ) if err != nil { log . err <- fmt . Errorf ( " " , err ) return } log . err <- nil }
listen will listen for log messages and write them
listen will listen for log messages and write them