1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-18 18:17:03 +00:00

SMTP server is running with new config engine

Web still not working
This commit is contained in:
James Hillyerd
2012-10-20 21:36:57 -07:00
parent ce9289140a
commit 81fea97a90
6 changed files with 153 additions and 56 deletions

46
logging.go Normal file
View File

@@ -0,0 +1,46 @@
package inbucket
import (
"log"
)
type LogLevel int
const (
ERROR LogLevel = iota
WARN
INFO
TRACE
)
var MaxLogLevel LogLevel = TRACE
// Error logs a message to the 'standard' Logger (always)
func Error(msg string, args ...interface{}) {
msg = "[ERROR] " + msg
log.Printf(msg, args...)
}
// Warn logs a message to the 'standard' Logger if MaxLogLevel is >= WARN
func Warn(msg string, args ...interface{}) {
if MaxLogLevel >= WARN {
msg = "[WARN ] " + msg
log.Printf(msg, args...)
}
}
// Info logs a message to the 'standard' Logger if MaxLogLevel is >= INFO
func Info(msg string, args ...interface{}) {
if MaxLogLevel >= INFO {
msg = "[INFO ] " + msg
log.Printf(msg, args...)
}
}
// Trace logs a message to the 'standard' Logger if MaxLogLevel is >= TRACE
func Trace(msg string, args ...interface{}) {
if MaxLogLevel >= TRACE {
msg = "[TRACE] " + msg
log.Printf(msg, args...)
}
}