Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuring log level #164

Closed
dscoppelletti opened this issue Sep 30, 2020 · 5 comments
Closed

Configuring log level #164

dscoppelletti opened this issue Sep 30, 2020 · 5 comments
Labels
kind/support Adopter support requests.

Comments

@dscoppelletti
Copy link

I am using Swift-Log initialized by LoggingSystem.bootstrap(StreamLogHandler.standardError), but on log messages with log level >= info are shown on the console window of XCode 12.0.1.
How can I configure the log level of the log messages shown on the console?
Thanks.

@dscoppelletti
Copy link
Author

OK, I figure out:

        LoggingSystem.bootstrap { label in
            var handler = StreamLogHandler.standardError(label: label)
            handler.logLevel = Logger.Level.debug
            return handler
        }

I would prefer some configuration feature, for example by label, but that's it.

@ktoso
Copy link
Member

ktoso commented Sep 30, 2020

Hi @dscoppelletti,

LoggingSystem.bootstrap(StreamLogHandler.standardError), but on log messages with log level >= info are shown on the console window of XCode 12.0.1.

Oh, but that's configurable on the logger you're using, see:

// LoggingSystem.bootstrap(StreamLogHandler.standardError)

var logger = Logger(label: "...")
logger.logLevel = .debug
logger.debug("hello")

this should print this message 👍


I would prefer some configuration feature, for example by label, but that's it.

sorry to disappoint but we really only intend swift-log to be the absolute bare minimum package -- that it even ships any log handlers is already pushing it.

As such, we will not be including any "proper log handler" features such as per label configurations or similar.
We hope for the community to step up and implement these features in separate packages shipping more specialized LogHandler implementations.

This falls in the same category as #162 where we unanimously agreed that more features must be kept out of the handlers we shipped and we must encourage more LogHandlers to be implemented.

This of it this way:

  • this package is ONLY the API
    • the fact that it ships any log handlers is sadly a historic artifact that we can't remove for now
  • any "proper" features should be pushed into LogHandler libraries as much as possible -- we really need to build up an ecosystem or at least a few really good log handlers.

@ktoso ktoso added new-backend kind/support Adopter support requests. and removed new-backend labels Sep 30, 2020
@ktoso
Copy link
Member

ktoso commented Sep 30, 2020

Please report back if this solves your issue and we can close the ticket?

@dscoppelletti
Copy link
Author

Yeah, it's fair.

@ktoso
Copy link
Member

ktoso commented Sep 30, 2020

Cool, thanks for reporting/asking!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support Adopter support requests.
Projects
None yet
Development

No branches or pull requests

2 participants