Skip to content

Conversation

@calmh
Copy link
Member

@calmh calmh commented Sep 4, 2025

This adds several options for configuring the log format of timestamps and severity levels, making it more suitable for integration with log systems like systemd.

--log-format-timestamp="2006-01-02 15:04:05"
   Format for timestamp, set to empty to disable timestamps ($STLOGFORMATTIMESTAMP)

--[no-]log-format-level-string
   Whether to include level string in log line ($STLOGFORMATLEVELSTRING)

--[no-]log-format-level-syslog
   Whether to include level as syslog prefix in log line ($STLOGFORMATLEVELSYSLOG)

So, to get a timestamp suitable for systemd (syslog prefix, no level string, no timestamp) we can pass --log-format-timestamp="" --no-log-format-level-string --log-format-level-syslog or, equivalently, set STLOGFORMATTIMESTAMP="" STLOGFORMATLEVELSTRING=false STLOGFORMATLEVELSYSLOG=true.

@github-actions github-actions bot added the chore label Sep 4, 2025
@calmh calmh changed the title chore: add logging mode for systemd (ref #10352) chore(slogutil): add logging mode for systemd (ref #10352) Sep 4, 2025
@calmh calmh force-pushed the logsystemd branch 3 times, most recently from 3a6c792 to 6cfcf7d Compare September 4, 2025 09:07
@calmh calmh changed the title chore(slogutil): add logging mode for systemd (ref #10352) chore(slogutil): add logging mode for systemd (fixes #10352) Sep 4, 2025
@imsodin
Copy link
Member

imsodin commented Sep 4, 2025

Edit: Didn't read the issue comments before posting this. Looks like this is pretty widely used, even beyond systemd, so even less reason to head the following.
Aren't most other types of log services likely to have the same issue with repeat timestamps? Just wondering if a generic option to disable timestamps would be worth it for broader applicability. Not personally complaining, most of my systems run systemd so the level stuff will be nice (didn't know that was a thing, looks weird in plain text :) ).

Copy link
Member

@imsodin imsodin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Just the general question in the earlier comment about whether to do this systemd specific thing or just to drop the timestamps.

Comment on lines 21 to 39
type formattingHandler struct {
attrs []slog.Attr
groups []string
type formattingOptions struct {
out io.Writer
recs []*lineRecorder
timeOverride time.Time
systemd bool
}

type formattingHandler struct {
attrs []slog.Attr
groups []string
opts *formattingOptions
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the motivation for formattingOptions? Just curious because I don't see it, don't mind it or anything.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thing with how handlers work with log/slog and With... that means the creates a copy of itself. When doing that it needs to copy all the attributes, and I've forgotten to do that more than once. I figured moving out the options that are "global" to all the handlers into a separate options type and just have everyone keep a reference to that would reduce mistakes.

@calmh calmh changed the title chore(slogutil): add logging mode for systemd (fixes #10352) chore(slogutil): add configurable logging format (fixes #10352) Sep 5, 2025
@calmh calmh force-pushed the logsystemd branch 3 times, most recently from f49bcce to 4963b18 Compare September 5, 2025 06:59
This adds several options for configuring the log format of timestamps
and severity levels, making it more suitable for integration with log
systems like systemd.

      --log-format-timestamp="2006-01-02 15:04:05"
         Format for timestamp, set to empty to disable timestamps ($STLOGFORMATTIMESTAMP)

      --[no-]log-format-level-string
         Whether to include level string in log line ($STLOGFORMATLEVELSTRING)

      --[no-]log-format-level-syslog
         Whether to include level as syslog prefix in log line ($STLOGFORMATLEVELSYSLOG)

So, to get a timestamp suitable for systemd (syslog prefix, no level
string, no timestamp) we can pass `--log-format-timestamp=""
--no-log-format-level-string --log-format-level-syslog` or,
equivalently, set `STLOGFORMATTIMESTAMP="" STLOGFORMATLEVELSTRING=false
STLOGFORMATLEVELSYSLOG=true`.

Signed-off-by: Jakob Borg <jakob@kastelo.net>
@calmh
Copy link
Member Author

calmh commented Sep 5, 2025

@imsodin please take another look at a more general solution

Copy link
Member

@acolomb acolomb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice generalization.

@calmh calmh merged commit 3625447 into syncthing:main Sep 5, 2025
33 checks passed
@acolomb
Copy link
Member

acolomb commented Sep 6, 2025

@calmh Would you mind opening a docs PR for the added command line options? As the PR template demands from other contributors... 😉

Hancock33 added a commit to Hancock33/batocera.piboy that referenced this pull request Sep 7, 2025
-------------------------------------------------------------------------------------------
rk3128-blobs.mk 74213af1e952c4683d2e35952507133b61394862 # Version: Commits on Jun 13, 2025
-------------------------------------------------------------------------------------------
rv1126b: bl31: update version to v1.07

Build from ATF commit:

    46bfa4121 plat: rv1126b: dfs: move to nstimer_ch5

update feature:

    46bfa4121 plat: rv1126b: dfs: move to nstimer_ch5

    ae4ae50d9 plat: rv1126b: support monitor

    0649e199a rockchip: timer: support to config frequency

    78fbec495 plat: rv1126b: open pd_npu

    69c408b3d plat: rv1126b: support SIP_MCU_CFG

    20c929767 plat: rv1126b: sleep: save/restore pvtpll registers

Change-Id: Ic1c1b175b48521406223d5e7fc475cb9c100c576

Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>,

-----------------------------------------------------------------------------------
ares.mk 1dffa3d974cc818739266f814a2bcec2d88b4165 # Version: Commits on Aug 27, 2025
-----------------------------------------------------------------------------------
nall: Fix linux-only compilation issue with owning string_view removal,

------------------------------------------------------------------------------------
cemu.mk 5a3809be16f2e196ee8bc117b6e6759d83313506 # Version: Commits on Sept 05, 2025
------------------------------------------------------------------------------------
windows: Add NSIS Windows installer (#1645)

License, user-install only and cleanups, mention in README,

-----------------------------------------------------------------------------------
clk.mk 26f82e8143b359d6425a89c78c1b313726f822c3 # Version: Commits on Sept 05, 2025
-----------------------------------------------------------------------------------
Merge pull request #1550 from TomHarte/SpaceshipOperator

Adopt spaceship.,

------------------------------------------------------------------------------------
eden.mk 718891d11f53a8496ce1462ce37a3c0d4083ba33 # Version: Commits on Sept 05, 2025
------------------------------------------------------------------------------------
[fs] temporarely disable nca verification (#298)

--------------------------------------------------------------------------------------
ikemen.mk 507cdeb04254140946c4e0ba95e040be31f9e231 # Version: Commits on Sept 05, 2025
--------------------------------------------------------------------------------------
Merge pull request #2627 from ikemen-engine/K4thos-patch-1

build: arenas env var,

--------------------------------------------------------------------------------------
ppsspp.mk 598d07305839eb74a4e75d93fa2bfbf074d5e1c8 # Version: Commits on Sept 05, 2025
--------------------------------------------------------------------------------------
Merge pull request #20797 from jonkadelic/master

GEDebugger: fixed Verts tab displaying Invalid,

-------------------------------------------------------------------------------------
rpcs3.mk f84df036515ad079926a22e03e489a56ee06cd4f # Version: Commits on Sept 05, 2025
-------------------------------------------------------------------------------------
SPU: Limit SPU self notifying thread to 12+ threaded CPUs,

----------------------------------------------------------------
ruffle.mk nightly-2025-09-05 # Version: Commits on Sept 05, 2025
----------------------------------------------------------------
## What's Changed

* avm2: Add lots of stubs for AIR by @Lord-McSweeney in ruffle-rs/ruffle#21502

**Full Changelog**: ruffle-rs/ruffle@nightly-2025-09-04...nightly-2025-09-05,

------------------------------------------------------
ryujinx.mk 1.3.135 # Version: Commits on Sept 05, 2025
------------------------------------------------------
Canary-1.3.135

---------------------------------------------------------------------------------------
shadps4.mk 43b72b59a2fa928184853f8be860cc57cecfd7da # Version: Commits on Sept 05, 2025
---------------------------------------------------------------------------------------
rtc: Fix date parsing detection. (#3524),

----------------------------------------------------------------------------------------
thextech.mk 2ea8ef6b9ddda7e4e8d64f64c18c4023596aeb7e # Version: Commits on Sept 05, 2025
----------------------------------------------------------------------------------------
Fix v1.3.7.1 bug where new down clip fix broke running on fall blocks

(Introduced in 433002a7b1cc0582e50ebc7a98c6c11d49ca86aa (main) and 66abf6a13113684e073372101cae46b6a221f551 (stable-1.3.7.x))

(cherry picked from commit 575da34d7689133afc5fad56869648dbc6e35f89),

--------------------------------------------------
vice.mk r45756 # Version: Commits on Sept 05, 2025
--------------------------------------------------
some log stuff

git-svn-id: https://svn.code.sf.net/p/vice-emu/code/trunk@45756 379a1393-f5fb-40a0-bcee-ef074d9b53f7,

------------------------------------------------------------------------------------
ymir.mk 0da56be4feecb3dbfc5b126c43b5d6a6603b7df7 # Version: Commits on Sept 05, 2025
------------------------------------------------------------------------------------
feat(media): Provide basic error feedback when attempting to load bad, corrupt or truncated disc images,

----------------------------------------------------------------------------------------
alephone.mk 64123217a7275aba951e22ab5e18aff36c54df74 # Version: Commits on Sept 04, 2025
----------------------------------------------------------------------------------------
Make the new sinusoidal music fade type constant power and ensure fade completion despite float precision,

-------------------------------------------------------------------------------------
box64.mk f639357591561e3487b29c55c56806ce702d020d # Version: Commits on Sept 05, 2025
-------------------------------------------------------------------------------------
[WRAPPER] Added VK_ARM_data_graph extension to vulkan wrapper (for #3008),

----------------------------------------------------------------------------------------
corsixth.mk 67429fd4d9960ad207114e01ace305331db163c3 # Version: Commits on Sept 05, 2025
----------------------------------------------------------------------------------------
Merge pull request #2995 from TheCycoONE/bump_vcpkg_sept_2025

Bump vcpkg version,

-------------------------------------------------------------------------------------------
devilutionx.mk f6b4665e94885a6c36f866e31ac877f4aa050878 # Version: Commits on Sept 05, 2025
-------------------------------------------------------------------------------------------
Make Player Class Data Data-Driven (#8167),

--------------------------------------------------------------------------------------------
jazz2-native.mk b61557c856e37d4fd450206ec1125990c2f335bb # Version: Commits on Sept 04, 2025
--------------------------------------------------------------------------------------------
Refactoring,

----------------------------------------------------
nblood.mk r14261 # Version: Commits on Sept 05, 2025
----------------------------------------------------
-

---------------------------------------------------------------------------------------
omf2097.mk 57779abae698b61e2e8b0670d393cbc3bea879af # Version: Commits on Sept 05, 2025
---------------------------------------------------------------------------------------
Hit mechanics overhaul (#1258)

* Prevent stunned getup animation from overriding forced launch animation

Forced launches now count as air hits for rehit mode

* Adjusted damage in rehit to match DOS

* Major overhaul of how har_take_damage works

* Formatting

* Fix damage calculation for hazards

* Fix air-hit rectest

* Re-recorded rectest,

-----------------------------------------------------------------------------------------
openmohaa.mk c93d0f69755f12ebfe364f977a7bdce44a821092 # Version: Commits on Sept 04, 2025
-----------------------------------------------------------------------------------------
Add standalone definition to avoid including steam/gog/msstore path,

---------------------------------------------------------------------------------------
stalker.mk 8eb6ce331bdefbd494b9af712aee0aada9d4c3f3 # Version: Commits on Sept 04, 2025
---------------------------------------------------------------------------------------
build(deps): bump Externals/imgui from `1f7f1f5` to `a28cb61` (#1930)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>,

-------------------------------------------------------
syncthing.mk v2.0.7 # Version: Commits on Sept 05, 2025
-------------------------------------------------------
## Major changes in 2.0

- Database backend switched from LevelDB to SQLite. There is a migration on

  first launch which can be lengthy for larger setups. The new database is

  easier to understand and maintain and, hopefully, less buggy.

- The logging format has changed to use structured log entries (a message

  plus several key-value pairs). Additionally, we can now control the log

  level per package, and a new log level WARNING has been inserted between

  INFO and ERROR (which was previously known as WARNING...). The INFO level

  has become more verbose, indicating the sync actions taken by Syncthing. A

  new command line flag `--log-level` sets the default log level for all

  packages, and the `STTRACE` environment variable and GUI has been updated

  to set log levels per package. The `--verbose` and `--logflags` command

  line options have been removed and will be ignored if given.

- Deleted items are no longer kept forever in the database, instead they are

  forgotten after fifteen months. If your use case require deletes to take

  effect after more than a fifteen month delay, set the

  `--db-delete-retention-interval` command line option or corresponding

  environment variable to zero, or a longer time interval of your choosing.

- Modernised command line options parsing. Old single-dash long options are

  no longer supported, e.g. `-home` must be given as `--home`. Some options

  have been renamed, others have become subcommands. All serve options are

  now also accepted as environment variables. See  `syncthing --help` and

  `syncthing serve --help` for details.

- Rolling hash detection of shifted data is no longer supported as this

  effectively never helped. Instead, scanning and syncing is faster and more

  efficient without it.

- A \default folder\ is no longer created on first startup.

- Multiple connections are now used by default between v2 devices. The new

  default value is to use three connections: one for index metadata and two

  for data exchange.

- The following platforms unfortunately no longer get prebuilt binaries for

  download at syncthing.net and on GitHub, due to complexities related to

  cross compilation with SQLite:

  - dragonfly/amd64

  - solaris/amd64

  - linux/ppc64

  - netbsd/*

  - openbsd/386 and openbsd/arm

  - windows/arm

- The handling of conflict resolution involving deleted files has changed. A

  delete can now be the winning outcome of conflict resolution, resulting in

  the deleted file being moved to a conflict copy.

This release is also available as:

* APT repository: https://apt.syncthing.net/

* Docker image: `docker.io/syncthing/syncthing:2.0.7` or `ghcr.io/syncthing/syncthing:2.0.7`

  (`{docker,ghcr}.io/syncthing/syncthing:2` to follow just the major version)

## What's Changed

### Fixes

* fix(model): earlier free-space check (fixes #10347) by @calmh in syncthing/syncthing#10348

* fix(api): redact device encryption passwords in support bundle config by @pixelspark in syncthing/syncthing#10359

* fix(sqlite): revert to default page cache size by @calmh in syncthing/syncthing#10362

* fix(tlsutil): support HTTP/2 on GUI/API connections by @calmh in syncthing/syncthing#10366

* fix(sqlite): avoid rowid on kv table by @calmh in syncthing/syncthing#10367

### Other

* chore(model): adjust folder state logging (fixes #10350) by @calmh in syncthing/syncthing#10353

* build: package for illumos using vmactions/omnios-vm by @trisk in syncthing/syncthing#10328

* chore(slogutil): add configurable logging format (fixes #10352) by @calmh in syncthing/syncthing#10354

## New Contributors

* @trisk made their first contribution in syncthing/syncthing#10328

**Full Changelog**: syncthing/syncthing@v2.0.6...v2.0.7,

-----------------------------------------------------------------------------------------
retroarch.mk 4c9357fff0f4c09ce462afba02d0f4e7d8fd3510 # Version: Commits on Sept 05, 2025
-----------------------------------------------------------------------------------------
Runtime logging cleanup,

--------------------------------------------------------------------------------------
libdof.mk fd1c4707c62cd0fbe65b9f5ea84bdd30b8cd0e1a # Version: Commits on Sept 04, 2025
--------------------------------------------------------------------------------------
pac: add support for pacled64, pacdrive, and pacuio (#23),

---------------------------------------------------------------------------------------
vpinball.mk e1f26aa42f2f5fb65d2d6637741de1b12f3bda7e # Version: Commits on Jul 23, 2024
---------------------------------------------------------------------------------------
misc: standalone builds for macos, ios, tvos, android, linux, and rpi,

------------------------------------------------------------------------------------
tr1x.mk 002ada89c94412bcef00d87fb6bf34958ca12dd9 # Version: Commits on Sept 04, 2025
------------------------------------------------------------------------------------
creature/common: fix aliveness test

This adjusts the check for testing if a creature is alive to take

into consideration floating water creatures, as they are technically

still active.

Resolves #3887.,

------------------------------------------------------------------------------------
tr2x.mk 002ada89c94412bcef00d87fb6bf34958ca12dd9 # Version: Commits on Sept 04, 2025
------------------------------------------------------------------------------------
creature/common: fix aliveness test

This adjusts the check for testing if a creature is alive to take

into consideration floating water creatures, as they are technically

still active.

Resolves #3887.,

-------------------------------------------------------------------------------------------
xash3d-fwgs.mk 598d756af16b9fc63b6e04fbee6a19ae14c42d94 # Version: Commits on Sept 05, 2025
-------------------------------------------------------------------------------------------
engine: platform: sdl2: hide SDL log messages under -dev 2, as they're often misleading for everybody except engine developers,

---------------------------------------------------------------------------------------------------
libretro-clownmdemu.mk 523a7c3734e655a62a66cf46a304752a95aeced9 # Version: Commits on Sept 04, 2025
---------------------------------------------------------------------------------------------------
Update common.,

----------------------------------------------------------------------------------------------
libretro-fbneo.mk 65f5ad254a9141b5b8ee5b0d6c742399a135314c # Version: Commits on Sept 05, 2025
----------------------------------------------------------------------------------------------
(libretro) update files,

------------------------------------------------------------------------------------------------------
libretro-genesisplusgx.mk 2fa79c1c643375662543afe9e1299a3cf1d55559 # Version: Commits on Sept 05, 2025
------------------------------------------------------------------------------------------------------
[SDL] revert previous commit debugging modifications (should not have been pushed upstream),

-----------------------------------------------------------------------------------------------
libretro-ppsspp.mk 598d07305839eb74a4e75d93fa2bfbf074d5e1c8 # Version: Commits on Sept 05, 2025
-----------------------------------------------------------------------------------------------
Merge pull request #20797 from jonkadelic/master

GEDebugger: fixed Verts tab displaying Invalid,

----------------------------------------------------------------------------------------------
libretro-tic80.mk 21aa81a1ac263d584bb2656d283fa149685bb82d # Version: Commits on Sept 05, 2025
----------------------------------------------------------------------------------------------
update lpeg submodule,
@calmh calmh deleted the logsystemd branch September 8, 2025 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants