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

Support debug logging #29

Closed
chrs1885 opened this issue Oct 23, 2018 · 1 comment
Closed

Support debug logging #29

chrs1885 opened this issue Oct 23, 2018 · 1 comment
Milestone

Comments

@chrs1885
Copy link
Owner

chrs1885 commented Oct 23, 2018

What kind of feature would you like to see?

When a debugger is attached, I'd like to see logs about certain events (e.g. initializations, notifications) produced by the Capable framework. Furthermore, it would be great expose an API to set my own logger implementation.

How does it work in detail?

By default, the framework uses the default logger implementation build upon os.log. If the debugger is attached, this will log different events (verbose, info, warning, error) coming from the framework code to the console.

If the dev needs to provide her own logger implementation, she can do so by providing a closure.

Also, setting a minimum log level should be supported: if the dev only wants the Capable framework to log warning or errors, she needs to set the log level to warnings.

What does the API look like?

Custom log closure

var log: (message: String, logLevel: OSLogType) -> () = { message, logLevel in
   MyCustomLogger.logToFile(component: "Capable", message: message, type: logLevel)
}

let capable = Capable()
capable.onLog = log
capable.logLevel = OS_LOG_TYPE_INFO

Any existing projects that do something similar?

Most SDKs.

@chrs1885 chrs1885 added this to the 0.8.0 milestone Oct 23, 2018
@chrs1885 chrs1885 added the in progress We are currently working on it. label Oct 23, 2018
@chrs1885 chrs1885 removed the in progress We are currently working on it. label Nov 10, 2018
@chrs1885
Copy link
Owner Author

Solved with #33

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

No branches or pull requests

1 participant