apple / apple/swift-log

Different log levels for different groups of loggers

Open
#215 7 comments 2 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
4k
Forks
344
Avg merge
1d 11h
Merged PRs (30d)
5

Description

One of the powerful features of Java's log4j is that different logging levels can be set for large swaths of the code. This is accomplished with a couple of things:

* Generally, each class has its own logger, named after the fully-qualified class name (Java has a hierarchical naming convention of pacakges and classes in them, e.g. `myapp.app.model.entities.Employee`
* Log level can be specified at any level, e.g. `myapp.app.model` should log at TRACE, everything else at ERROR.
* If a logger doesn't have a specific log level set, it uses its parent's level

These levels can be set at run time, making it easy to turn up or down the logging on parts of the code you need to focus on, without obscuring the output with too many messages from uninteresting code.

I don't see a way for swift-log to do that.

Contributor guide

Open the contributing guide

Research direction

No files or tests are named. Start by reading the swift-log logging API and its current log-level behavior, then determine how hierarchical logger names, inherited levels, and runtime updates should work. Done means different logger groups can use distinct levels while unspecified loggers inherit from their parents.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
observability
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.