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

Logger instance #3

Closed
yichizhang opened this issue Mar 18, 2016 · 3 comments
Closed

Logger instance #3

yichizhang opened this issue Mar 18, 2016 · 3 comments

Comments

@yichizhang
Copy link

Hi Damien, the library is great, thanks.
I have one suggestion for the last line in Logger.swift:
public let Log = Logger(formatter: .Default, theme: .Default)

First thing is, the name of an instance should not be capitalized? Would public let log = be better?
Also, what do you think about leaving the responsibility of creating a Logger instance to the user, by deleting that line?

@delba
Copy link
Owner

delba commented Mar 18, 2016

Hi Yichi, thank you for your interest!

  1. The capitalized instance surely isn't conventional but it prefer it over Logger.standardLogger() or log. If the user just uses one logger, I don't want him to think about Log as an instance. Log.trace("hi") will look like a static func and spare him some mental burden.
  2. I want to keep a default logger. It's kind of "plug-and-play". In my case, I only use one logger (the Log instance) and I just change its theme with Log.theme = ... to match my editor's one.
    However you can access the Logger class to create your own from scratch (see here).

Thanks again 😃

/cc @yichizhang

@delba delba closed this as completed Mar 18, 2016
@yichizhang
Copy link
Author

Cool! Yes it makes more sense to me now. Thanks.

@delba
Copy link
Owner

delba commented Mar 19, 2016

@yichizhang Actually you're right 😄

I was used to use it without carthage/cocoapods and I didn't realize the pain of all those import Log at the top of our files...

I just release the v0.3 version and updated the README.

Thanks and sorry about that!

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

2 participants