Skip to main content

SteamLogger

SteamLogger is a small Rust application that watches one Steam account and writes a line in a JSON file for every game session: what you played, when it started, when it stopped — and, optionally, which friends were playing the same game, which friends shared your lobby, and the server name and map you were connected to.

It is a single binary with no database, no daemon framework and no background service manager of its own. It polls the Steam Web API, keeps a tiny state machine in memory, and rewrites one JSON file atomically on every tick.

steamlog.json
{
"games": [
{
"name": "Team Fortress 2",
"start": "2026-08-10T14:32:15-03:00",
"end": "2026-08-10T16:47:03-03:00",
"map": "cp_dustbowl",
"server": "Team Fortress 2 #42",
"friends_playing": ["medicmain99"],
"friends_in_lobby": ["medicmain99"]
}
]
}

What it does​

CapabilityHow it is obtainedModule
Detect game start / stop / switchISteamUser/GetPlayerSummaries polled every N secondstracker
Friends playing the same gameGetFriendList + batched GetPlayerSummaries, matched on gameidenrich
Friends in your exact lobbysame batch, matched on lobbysteamidenrich
Server name + current mapdirect A2S_INFO UDP query to gameserveripa2s
Crash-safe log filepretty JSON written to a temp file, then renamed over the targetstorage
Resume after restartlast entry with end: null is treated as still runningtracker

What it does not do​

  • It does not read local Steam files, inject into games, or use your password — only a read-only Web API key and a public SteamID64.
  • It does not track playtime for other people; friends are only recorded as names attached to your sessions.
  • It does not retry failed polls faster, back off, or queue writes. A failed poll is logged to stderr and the next tick simply tries again.
  • It does not rotate or prune the log file; the whole file is rewritten each tick.

The 60-second tour​

Read Architecture → Overview for the full picture, or The poll loop for a tick-by-tick walkthrough.

How this documentation is organised​

Getting started Install the toolchain, get an API key, write a config, run the binary, and keep it running in the background on Linux, macOS or Windows.

Configuration & Log format Every TOML key, every environment variable, every JSON field — with types, defaults, validation rules and worked examples.

Architecture How the modules fit together, what happens on each tick, the session state machine, the enrichment pipeline, and the failure model.

Code reference One page per module. Every public type and function, its signature, behaviour, error cases, and the tests that cover it.

Guides Practical recipes: querying the log with jq, and using steamlogger as a library crate from your own Rust code.

Contributing Local development, the full test inventory, and how to edit these docs.

Requirements at a glance​

  • Rust 1.75+ with cargo (install).
  • A free Steam Web API key.
  • Your numeric SteamID64, and a Steam profile whose game details are public — otherwise the API reports nothing to log.
  • Outbound HTTPS to api.steampowered.com, plus outbound UDP if you want server/map enrichment.

:::tip Privacy note steamlogger.toml holds your API key and steamlog.json holds your play history. Both are already listed in the repository .gitignore — keep them out of commits. :::