56 lines
1.2 KiB
Go
56 lines
1.2 KiB
Go
|
package loggo
|
||
|
|
||
|
// timestamp placeholder
|
||
|
const PLACEHOLDER_TIMESTAMP = "$TIMESTAMP$"
|
||
|
|
||
|
// log level placeholder
|
||
|
const PLACEHOLDER_LOGLEVEL = "$LOGLEVEL$"
|
||
|
|
||
|
// message placeholder
|
||
|
const PLACEHOLDER_MESSAGE = "$MESSAGE$"
|
||
|
|
||
|
// time difference placeholder
|
||
|
const PLACEHOLDER_TIMEDIFF = "$TIMEDIFF$"
|
||
|
|
||
|
// extras placeholder
|
||
|
const PLACEHOLDER_EXTRAS = "$EXTRAS$"
|
||
|
|
||
|
// current log format (defaults to: "$TIMESTAMP$ - [$LOGLEVEL$] > $MESSAGE ($EXTRAS$) [$TIMEDIFF$]")
|
||
|
var logFormat = "$TIMESTAMP$ - [$LOGLEVEL$] > $MESSAGE ($EXTRAS$) [$TIMEDIFF$]"
|
||
|
|
||
|
// current date format (defaults to: "02.01.2006 15:04:05")
|
||
|
var dateFormat = "02.01.2006 15:04:05"
|
||
|
|
||
|
// current extras separator (defaults to: "|")
|
||
|
var extrasSeparator = "|"
|
||
|
|
||
|
// get current log format
|
||
|
func GetLogFormat() string {
|
||
|
return logFormat
|
||
|
}
|
||
|
|
||
|
// set current prefix format
|
||
|
func SetLogFormat(format string) {
|
||
|
logFormat = format
|
||
|
}
|
||
|
|
||
|
// get current date format
|
||
|
func GetDateFormat() string {
|
||
|
return dateFormat
|
||
|
}
|
||
|
|
||
|
// set current date format
|
||
|
func SetDateFormat(format string) {
|
||
|
dateFormat = format
|
||
|
}
|
||
|
|
||
|
// get current extras separator
|
||
|
func GetExtrasSeparator() string {
|
||
|
return extrasSeparator
|
||
|
}
|
||
|
|
||
|
// set current extras separator
|
||
|
func SetExtrasSeparator(separator string) {
|
||
|
extrasSeparator = separator
|
||
|
}
|