downlink
One log format for every process on a machine: rotating files several processes can share, uncaught exceptions in the log, one live switch for every console, and a reader for what was written.
A downlink carries what a spacecraft records back to the ground. This package does the same for your processes: each one writes the same line, nothing is lost when two of them rotate one file, and whatever watches the logs reads the lines back as records.
- Shared files that keep every line. The standard library's
RotatingFileHandlerloses lines when two processes rotate one file.configurelocks around the rotation. - Crashes land in the log. An uncaught exception, in the process or in a thread, is written as CRITICAL with its traceback. The console still shows it. Ctrl+C is not a crash.
- One console switch, no restart. Set a level once and every running process follows within a second. Errors always get through, and log files keep everything.
- Stamps carry their offset. Log lines stay comparable across a daylight saving change.
- Task lines for Django. A run reads as one block under the task's name.
- A reader for all of it. Read the lines back newest first, Caddy's JSON logs included.
Install
Requires Python 3.14 or newer. downlink.tasks also needs Django 6.1 or newer: take the django extra.
uv add cyberise-downlink
uv add "cyberise-downlink[django]"
You install cyberise-downlink and import downlink. The package named downlink on PyPI is a
different project.
Log to a file
Call configure once, early. Calling it again changes nothing, so a loop may call it freely.
from pathlib import Path
import downlink
log = downlink.configure(name="probe", log_file=Path("logs") / "probe.log")
log.info("engines warm")
2026-11-05T09:18:31+0100 INFO engines warm
- Each file rotates at 2 MB and keeps three backups.
- The logger stops propagating, so your program's console output stays its own.
configurecreates the file's directory, one level deep. If it cannot, it says so on stderr and the program runs on without a log file.- The first
configurein a process also installs the crash hooks. Withoutconfigure, calldownlink.record_crashes(logger)yourself.
Log from Django
import logging
import downlink
from django.utils import timezone
BOARD = BASE_DIR / "state" / "deck-loglevel.json" # see "Switch every console at once"
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"verbose": {
"()": "downlink.StampFormatter",
"fmt": downlink.DJANGO_VERBOSE,
"style": "{",
"zone": timezone.get_default_timezone,
},
},
"filters": {"deck_level": {"()": "downlink.DeckLevelFilter", "board_path": BOARD}},
"handlers": {
"console": {
"class": "downlink.ConsoleHandler",
"filters": ["deck_level"],
"zone": timezone.get_default_timezone,
},
},
"root": {"handlers": ["console"], "level": "INFO"},
}
Install the crash hooks in an app's ready:
downlink.record_crashes(logging.getLogger("shop.crashes"))
StampFormatter writes the full stamp with its offset for your log files. ConsoleHandler draws
the console line: time of day, level in its colour, message. Both take a zone callable; leave
it out for the machine's local time. Pass timezone.get_default_timezone, not the current
timezone, so a log line keeps the project's clock whoever caused it.
Switch every console at once
The deck is every process on one machine. The board is a small JSON file they all read; the filter looks at it again at most once per second, and only when there is a line to judge. Without a board, or with an unreadable one, everything passes.
import datetime
from pathlib import Path
from downlink import decklevel
board = Path("state") / "deck-loglevel.json"
now = datetime.datetime.now().astimezone()
decklevel.set_level(board, "warning", now=now) # quiet every console
decklevel.set_focus(board, topic="shop.worker", level="debug", now=now) # but watch this one
decklevel.clear(board) # back to each process's own setting
The levels are DEBUG, INFO, NOTICE and WARNING. NOTICE (25) sits between INFO and WARNING, and
importing downlink registers it. A focus matches a logger name as a dotted prefix, the longest
match winning. Processes that print instead of log ask downlink.allowed(board, level=..., topic=...).
Task lines
downlink.tasks replaces Django's own Task id=… state=… lines. Every line names the task, and
what the task logs while it runs stands under its name:
send_invoices ○ queued default · every 15 minutes · next 08:18:45
send_invoices ▶ running default
send_invoices │ invoices sent 12 · failed 0
send_invoices ✓ ok 2s
INSTALLED_APPS = [..., "downlink.tasks.TaskLines"]
DOWNLINK_TASK_LOGGER_PREFIX = "shop"
A logger name is the prefix, the part the process plays and the queue:
shop.worker.default for a run, shop.scheduler.default for what the scheduler queued,
shop.tasks.default for what any other process queued. With
django-scheduled-tasks installed, the
scheduler's line adds the schedule, the lateness and the next run. No other module imports Django.
Read the logs back
import datetime
from pathlib import Path
import downlink
an_hour_ago = datetime.datetime.now().astimezone() - datetime.timedelta(hours=1)
for record in downlink.records_since(Path("logs") / "probe.log", since=an_hour_ago):
if downlink.is_trouble(record):
print(record.when, record.level, record.message)
- The reader understands
LINE_FORMAT, whichconfigurewrites,DJANGO_VERBOSEand Caddy's JSON lines. - A traceback joins the record it follows.
- It reads the last 4 MiB of one file and does not follow rotated backups.
is_troublemeans WARNING and above, minus a few warnings Caddy raises by design.
Read another program's output
downlink.pipe.level_and_message(line) reads the level of a line another program wrote, so you
can forward it to a logger:
from downlink import pipe
log.log(*pipe.level_and_message("Error: address in use"))
Develop
just install # dependencies, hooks
just test
just lint
just build # the wheel
Metadata
Release files for cyberise-downlink 2026.11.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cyberise_downlink-2026.11.3.tar.gz | 21.2 kB | With provenance | Details for cyberise_downlink-2026.11.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cyberise_downlink-2026.11.3-py3-none-any.whl | Python 3 | none | any | Details for cyberise_downlink-2026.11.3-py3-none-any.whl |
Total release size: 43.6 kB
Release files / cyberise_downlink-2026.11.3.tar.gz
| Download URL | cyberise_downlink-2026.11.3.tar.gz |
|---|---|
| Size | 21.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b218482b524b7ed6806de1bd727d9772ae3619d4e6fbeeca1feb18b62a327d20
|
|
BLAKE2b-256 checksum How to use checksums |
f0452806ed114181df4a14935371ee639930da78acd8920a8c6ce4245e1a2839
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.
Transparency logRelease files / cyberise_downlink-2026.11.3-py3-none-any.whl
| Download URL | cyberise_downlink-2026.11.3-py3-none-any.whl |
|---|---|
| Size | 22.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bab1c221a1f0869d2d19da9e832c37357dd66ef69de1578d53d199dc68007daf
|
|
BLAKE2b-256 checksum How to use checksums |
4b2b02000ac0032c2efc7430ef21e5e048dadedfb54c792da4fac5ffa615601b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.
Transparency logSecurity for cyberise-downlink 2026.11.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for cyberise_downlink-2026.11.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 13, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.