From 4ae16bce8c6aa8e3d96ca69015d2065badee3994 Mon Sep 17 00:00:00 2001 From: Daenney Date: Mon, 21 Aug 2023 20:07:55 +0200 Subject: [feature] Make log format configurable (#2130) * [feature] Don't emit timestamp in log lines When running gotosocial with a service manager like systemd, or a container runtime, the associated log driver usually emits timestamps itself. In those cases, having the extra timestamp from our own log lines ends up being a bit noisy and when centrally ingesting logs is duplicate information. This introduces a configuration flag that allows disabling emitting the timestamp. It's only wired up for "daemonised" processes, meaning server and testrig. * [chore] Add docs for log-timestamp * [feature] Simplify timestamp handling Co-Authored-By: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> * [chore] Less escaped double-quotes * [chore] Fix help string --------- Co-authored-by: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> --- cmd/gotosocial/common.go | 1 + 1 file changed, 1 insertion(+) (limited to 'cmd') diff --git a/cmd/gotosocial/common.go b/cmd/gotosocial/common.go index b797e6590..baf8a15b5 100644 --- a/cmd/gotosocial/common.go +++ b/cmd/gotosocial/common.go @@ -63,6 +63,7 @@ func preRun(a preRunArgs) error { // The idea here is to take a GTSAction and run it with the given // context, after initializing any last-minute things like loggers etc. func run(ctx context.Context, action action.GTSAction) error { + log.SetTimeFormat(config.GetLogTimestampFormat()) // Set the global log level from configuration if err := log.ParseLevel(config.GetLogLevel()); err != nil { return fmt.Errorf("error parsing log level: %w", err) -- cgit v1.2.3