mirror of
https://github.com/alice-lg/birdwatcher.git
synced 2025-03-09 00:00:05 +01:00
Removed timestamp from logging output.
This commit is contained in:
parent
791b2a04ba
commit
681fcc60ea
1 changed files with 6 additions and 8 deletions
|
@ -2,11 +2,9 @@ package main
|
|||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"strings"
|
||||
|
||||
|
@ -126,6 +124,8 @@ func (m *MyLogger) Write(p []byte) (n int, err error) {
|
|||
}
|
||||
|
||||
func main() {
|
||||
// Disable timestamps for the default logger, as they are generated by the syslog implementation
|
||||
log.SetFlags(log.Flags() &^ (log.Ldate | log.Ltime))
|
||||
bird6 := flag.Bool("6", false, "Use bird6 instead of bird")
|
||||
workerPoolSize := flag.Int("worker-pool-size", 8, "Number of go routines used to parse routing tables concurrently")
|
||||
configfile := flag.String("config", "/etc/birdwatcher/birdwatcher.conf", "Configuration file location")
|
||||
|
@ -168,12 +168,10 @@ func main() {
|
|||
// Make server
|
||||
r := makeRouter(conf.Server)
|
||||
|
||||
// Set up our own custom log.Logger
|
||||
// Use this weird golang format to imitate log.Logger's timestamp in log.Prefix()
|
||||
ts := time.Now().Format("2006/01/02 15:04:05")
|
||||
// set log prefix timestamp to our own custom prefix
|
||||
log.SetPrefix(ts)
|
||||
myquerylog := log.New(os.Stdout, fmt.Sprintf("%s %s: ", ts, "QUERY"), 0)
|
||||
// Set up our own custom log.Logger without a prefix
|
||||
myquerylog := log.New(os.Stdout, "", 0)
|
||||
// Disable timestamps, as they are contained in the query log
|
||||
myquerylog.SetFlags(myquerylog.Flags() &^ (log.Ldate | log.Ltime))
|
||||
mylogger := &MyLogger{myquerylog}
|
||||
|
||||
if conf.Server.EnableTLS {
|
||||
|
|
Loading…
Add table
Reference in a new issue