package config import ( "io" "io/ioutil" "log" "os" "strings" "git.giaever.org/joachimmg/go-log.git/errors" ) type LogPrefix string type LogLevel int type LogHandle io.Writer type LogFlag int type LogDir string var ( // DiscardHandle: used when log level isnt reached (discard log) DiscardHandle LogHandle = ioutil.Discard // HandleTrace: output dest for trace log HandleTrace LogHandle = os.Stdout // HandleInfo: output dest for info log HandleInfo LogHandle = os.Stdout // HandleWarning: output dest for warning log HandleWarning LogHandle = os.Stdout // HandleError: output dest for error log HandleError LogHandle = os.Stdout // HandlePanic: output dest for panic log HandlePanic LogHandle = os.Stderr // Ldir: Log directory, where file (not "output") logs are stored. Ldir LogDir = LogDir(os.TempDir() + string(os.PathSeparator) + "go-log") ) const ( // LogFormat: format in front of log text LogFormat = log.Ldate | log.Lmicroseconds // FileMask: filedescriptor mask FileMask = os.O_CREATE | os.O_WRONLY | os.O_APPEND // FilePerm: File permission, 0600 FilePerm = 0600 ) const ( // PrefixTrace: Log prefix for trace PrefixTrace LogPrefix = "TRACE" // PrefixInfo: Log prefix for info PrefixInfo LogPrefix = "INFO" // PrefixWarning: Log prefix for warning PrefixWarning LogPrefix = "WARNING" // PrefixError: Log prefix for error PrefixError LogPrefix = "ERROR" // PrefixPanic: Log prefix for panic PrefixPanic LogPrefix = "PANIC" ) const ( // Trace level Trace LogLevel = 1<