summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakob Borg <jakob@kastelo.net>2022-04-15 07:46:14 +0400
committerGitHub <noreply@github.com>2022-04-15 07:46:14 +0400
commit61dffabf974109fc47146c56d6843e22b9c68adc (patch)
tree0ab3dbfa14bb0f11bd79e591af12def312973f57
parentbc27aa12cd9ffd7b64e0144cd3e7423f1dbf8ea8 (diff)
cmd/syncthing, lib/logger: Add date to default log format (fixes #8272) (#8273)v1.20.0-rc.1
This changes the default log format to include the date.
-rw-r--r--cmd/syncthing/main.go8
-rw-r--r--lib/logger/logger.go2
2 files changed, 5 insertions, 5 deletions
diff --git a/cmd/syncthing/main.go b/cmd/syncthing/main.go
index 3b9cfe59b..f248b3b98 100644
--- a/cmd/syncthing/main.go
+++ b/cmd/syncthing/main.go
@@ -68,9 +68,9 @@ The --logflags value is a sum of the following:
8 Long filename
16 Short filename
-I.e. to prefix each log line with date and time, set --logflags=3 (1 + 2 from
-above). The value 0 is used to disable all of the above. The default is to
-show time only (2).
+I.e. to prefix each log line with time and filename, set --logflags=18 (2 + 16
+from above). The value 0 is used to disable all of the above. The default is
+to show date and time (3).
Logging always happens to the command line (stdout) and optionally to the
file at the path specified by --logfile=path. In addition to an path, the special
@@ -187,7 +187,7 @@ type serveOptions struct {
func defaultVars() kong.Vars {
vars := kong.Vars{}
- vars["logFlags"] = strconv.Itoa(log.Ltime)
+ vars["logFlags"] = strconv.Itoa(logger.DefaultFlags)
vars["logMaxSize"] = strconv.Itoa(10 << 20) // 10 MiB
vars["logMaxFiles"] = "3" // plus the current one
diff --git a/lib/logger/logger.go b/lib/logger/logger.go
index 731be426b..ecf20fd41 100644
--- a/lib/logger/logger.go
+++ b/lib/logger/logger.go
@@ -31,7 +31,7 @@ const (
)
const (
- DefaultFlags = log.Ltime
+ DefaultFlags = log.Ltime | log.Ldate
DebugFlags = log.Ltime | log.Ldate | log.Lmicroseconds | log.Lshortfile
)