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

Updates to Logging #906

Merged
merged 5 commits into from Nov 2, 2018
Merged

Updates to Logging #906

merged 5 commits into from Nov 2, 2018

Conversation

danthorpe
Copy link
Member

@danthorpe danthorpe commented Oct 24, 2018

  • Exposes the log channel via settings.
    It defaults to the shared instance, but framework consumers will be able to implement their own LogChannel and set it using:

    Log.channel = mySpecialChannel
  • Removes system log (which used a private log writer)
    This will allow framework consumers to re-direct all logging through a central log channel/writer/formatter as they wish. This means, that framework consumers can use the default Log.Channel instance, but could set a special log writer, for example:

    Log.writer = mySpecialLogWriter

    which is equivalent of:

    Log.channel.writer = mySpecialLogWriter
  • For platforms which support OSLog
    Added an API to use the default LogWriter (Log.Writers.OSLogWriter) but with a given instance of OSLog - this will allow framework consumers to setup the log using their own subsystem and category. Unfortunately, at this time, we can only use a single OSLog instance. It is recommended that app developers create a OSLog instance dedicated for ProcedureKit and use their bundle ID as the subsystem, and "ProcedureKit" as the category.

Created following discussions in #899

So, for example, it's now possible to do this:

Log.writer = Log.Writers.Redirecting(writers: [
    Log.Writers.OSLogWriter(log: myOSLog), 
    remoteCloudLogger])

@pronebird
Copy link
Contributor

@danthorpe are devs able or supposed to use Log facilitates outside of Operations?

@danthorpe
Copy link
Member Author

Well, when I initially refactored the logger, I wanted ProcedureKit contributors to be able to get logs on how the framework works, which would be separate from the logger that framework consumers might want to use for their own purposes.

But to be honest, following discussions in #899 - it's kinda easier to put everything into a single logger really.

@danthorpe danthorpe merged commit 9f20747 into development Nov 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants