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

Add a debug Option to the Tracker. #147

Closed
brototyp opened this issue May 25, 2017 · 1 comment
Closed

Add a debug Option to the Tracker. #147

brototyp opened this issue May 25, 2017 · 1 comment

Comments

@brototyp
Copy link
Member

Right now it is pretty hard to debug the tracker if something goes wrong or not as expected. I think we should be more verbose at some points without being to talky.

  • What are events that we want to log per default?
    • Failed dispatching?
  • How should we categorize logs? Just debug yes/no? Or more complex verbose/debug/info/warning/error? I think debug yes/no should be enough.
  • How should we log the messages? Always to the console?
@brototyp
Copy link
Member Author

How about defining a simple logger protocol like so:

protocol Logger {
    func log(message: String)
    func debug(message: String)
}

final class ConsoleLogger: Logger {
    func log(message: String) {
        print("[PiwikTracker] | \(message)")
    }
    func debug(message: String) {
        print("[PiwikTracker] Debug | \(message)")
    }
}

let logger: Logger = ConsoleLogger()
logger.log(message: "This is an important message!")
logger.debug(message: "This is just a debug message.")

For now we just use the ConsoleLogger. In the future we can then give users the option to create a custom logger that passes the messages to their own logging mechanism.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant