mirror of
https://github.com/mickael-kerjean/filestash
synced 2026-01-04 06:43:18 +01:00
feature (log): enable more log types
This commit is contained in:
parent
d1890ecb33
commit
9b60ac6301
2 changed files with 5 additions and 5 deletions
|
|
@ -32,7 +32,7 @@ type log struct {
|
|||
|
||||
func (l *log) Info(format string, v ...interface{}) {
|
||||
if l.info && l.enable {
|
||||
message := fmt.Sprintf("%s INFO ", l.now())
|
||||
message := fmt.Sprintf("%s SYST INFO ", l.now())
|
||||
message = fmt.Sprintf(message+format+"\n", v...)
|
||||
|
||||
logfile.WriteString(message)
|
||||
|
|
@ -42,7 +42,7 @@ func (l *log) Info(format string, v ...interface{}) {
|
|||
|
||||
func (l *log) Warning(format string, v ...interface{}) {
|
||||
if l.warn && l.enable {
|
||||
message := fmt.Sprintf("%s WARN ", l.now())
|
||||
message := fmt.Sprintf("%s SYST WARN ", l.now())
|
||||
message = fmt.Sprintf(message+format+"\n", v...)
|
||||
|
||||
logfile.WriteString(message)
|
||||
|
|
@ -52,7 +52,7 @@ func (l *log) Warning(format string, v ...interface{}) {
|
|||
|
||||
func (l *log) Error(format string, v ...interface{}) {
|
||||
if l.error && l.enable {
|
||||
message := fmt.Sprintf("%s ERROR ", l.now())
|
||||
message := fmt.Sprintf("%s SYST ERROR ", l.now())
|
||||
message = fmt.Sprintf(message+format+"\n", v...)
|
||||
|
||||
logfile.WriteString(message)
|
||||
|
|
@ -62,7 +62,7 @@ func (l *log) Error(format string, v ...interface{}) {
|
|||
|
||||
func (l *log) Debug(format string, v ...interface{}) {
|
||||
if l.debug && l.enable {
|
||||
message := fmt.Sprintf("%s DEBUG ", l.now())
|
||||
message := fmt.Sprintf("%s SYST DEBUG ", l.now())
|
||||
message = fmt.Sprintf(message+format+"\n", v...)
|
||||
|
||||
logfile.WriteString(message)
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ func Logger(ctx App, res http.ResponseWriter, req *http.Request) {
|
|||
telemetry.Record(point)
|
||||
}
|
||||
if Config.Get("log.enable").Bool() {
|
||||
Log.Info("HTTP %3d %3s %6.1fms %s", point.Status, point.Method, point.Duration, point.RequestURI)
|
||||
Log.Stdout("HTTP %3d %3s %6.1fms %s", point.Status, point.Method, point.Duration, point.RequestURI)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue