// outputMessage outputs formatted mesage into stdout, syslog and file if message level is high enough
outputMessage outputs formatted mesage into stdout, syslog and file if message level is high enough
// outputMessage outputs formatted mesage into stdout syslog and file if message level is high enough
func outputMessage(pattern string, args []interface{}, level Level, depth int) error {
	if level > maxConsoleLevel && level > maxSyslogLevel && level > maxFileLevel {
		return nil 
	}
	if checkMessagesLimit() {
		return nil
	}
	_, file, line, _ := runtime.Caller(depth)
	short := file
	for i := len(file) - 1; i > 0; i-- {
		if file[i] == '/' {
			short = file[i+1:]
			break
		}
	}
	text := getText(args, pattern, level, short, line)
	var err error
	msg := "."
	if text != lastMessage {
		if isRepeated {
			msg = time.Now().Format("\n2006-01-02 15:04:05 ") + text
			isRepeated = false
		} else {
			msg = time.Now().Format("2006-01-02 15:04:05 ") + text
		}
		lastMessage = text
	} else {
		isRepeated = true
	}
	if level <= maxConsoleLevel {
		if level <= L_warning {
			_, err = fmt.Fprint(os.Stderr, msg)
		} else {
			_, err = fmt.Fprint(os.Stdout, msg)
		}
		if err != nil {
			return err
		}
	}
	if (sys != nil) && (level <= maxSyslogLevel) {
		switch level {
		default:
			fallthrough
		case L_fatal:
			err = sys.Emerg(text)
		case L_alert:
			err = sys.Alert(text)
		case L_critical:
			err = sys.Crit(text)
		case L_error:
			err = sys.Err(text)
		case L_warning:
			err = sys.Warning(text)
		case L_notice:
			err = sys.Notice(text)
		case L_info:
			err = sys.Info(text)
		case L_debug:
			err = sys.Debug(text)
		}
		if err != nil {
			return err
		}
	}
	if (logFile != "") && (level <= maxFileLevel) {
		f, err := os.OpenFile(logFile, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0644)
		if err != nil {
			logFile = ""
			return err
		} else {
			if _, err = f.WriteString(msg); err != nil {
				logFile = ""
				return err
			}
			return f.Close()
		}
	}
	return nil
}
func outputMessage ( pattern string , args [ ] interface { } , level Level , depth int ) error { if level > maxConsoleLevel && level > maxSyslogLevel && level > maxFileLevel { return nil } if checkMessagesLimit ( ) { return nil } _ , file , line , _ := runtime . Caller ( depth ) short := file for i := len ( file ) - 1 ; i > 0 ; i -- { if file [ i ] == '/' { short = file [ i + 1 : ] break } } text := getText ( args , pattern , level , short , line ) var err error msg := " " if text != lastMessage { if isRepeated { msg = time . Now ( ) . Format ( " \n " ) + text isRepeated = false } else { msg = time . Now ( ) . Format ( " " ) + text } lastMessage = text } else { isRepeated = true } if level <= maxConsoleLevel { if level <= L_warning { _ , err = fmt . Fprint ( os . Stderr , msg ) } else { _ , err = fmt . Fprint ( os . Stdout , msg ) } if err != nil { return err } } if ( sys != nil ) && ( level <= maxSyslogLevel ) { switch level { default : fallthrough case L_fatal : err = sys . Emerg ( text ) case L_alert : err = sys . Alert ( text ) case L_critical : err = sys . Crit ( text ) case L_error : err = sys . Err ( text ) case L_warning : err = sys . Warning ( text ) case L_notice : err = sys . Notice ( text ) case L_info : err = sys . Info ( text ) case L_debug : err = sys . Debug ( text ) } if err != nil { return err } } if ( logFile != " " ) && ( level <= maxFileLevel ) { f , err := os . OpenFile ( logFile , os . O_CREATE | os . O_APPEND | os . O_WRONLY , 0644 ) if err != nil { logFile = " " return err } else { if _ , err = f . WriteString ( msg ) ; err != nil { logFile = " " return err } return f . Close ( ) } } return nil }
outputMessage outputs formatted mesage into stdout, syslog and file if message level is high enough
outputMessage outputs formatted mesage into stdout syslog and file if message level is high enough
// silently ignore message // Don't try to write in this file anymore