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.
{
"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
| Capability | How it is obtained | Module |
|---|---|---|
| Detect game start / stop / switch | ISteamUser/GetPlayerSummaries polled every N seconds | tracker |
| Friends playing the same game | GetFriendList + batched GetPlayerSummaries, matched on gameid | enrich |
| Friends in your exact lobby | same batch, matched on lobbysteamid | enrich |
| Server name + current map | direct A2S_INFO UDP query to gameserverip | a2s |
| Crash-safe log file | pretty JSON written to a temp file, then renamed over the target | storage |
| Resume after restart | last entry with end: null is treated as still running | tracker |
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.
:::