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

Commit 1afb1674159d2adc222e488448e6b1738ed5d0e6 broke ddLogLevel handling? #478

Closed
afoo opened this issue Mar 16, 2015 · 14 comments
Closed
Milestone

Comments

@afoo
Copy link

afoo commented Mar 16, 2015

1afb167

How would '#ifdef ddLogLevel' ever be true at compile time if I use a variable?

Either I'm missing something or this keeps ddLogLevel from ever being used in that case.

@rivera-ernesto
Copy link
Member

I noticed the same thing here: #473 (comment)

For now the fix is to #define LOG_LEVEL_DEF ddLogLevel before importing CocoaLumberjack.

@DoctorG
Copy link

DoctorG commented Mar 16, 2015

Thanks!

@bpoplauschi bpoplauschi modified the milestones: 2.0.1, 2.x.x Mar 17, 2015
@veegee
Copy link

veegee commented Mar 28, 2015

Wow this is a critical bug. The documentation is so out of sync as well.

Why upgrade to 2.0.0 before thorough testing? I can't get the latest version on cocoapods.

@rivera-ernesto
Copy link
Member

It is a bug, but not critical, and in the mean time you can follow my advice above to fix it.

I would also put a notice about it in the README.


Is is a feature (really). It allows new users to start using the library right away.

@DanSkeel
Copy link

I thought I'm crazy and I can't figure out how to use a well documented super popular logging framework. You should mention this bug in docs.

@rivera-ernesto
Copy link
Member

It is in the README but feel free to improve on it.

@veegee
Copy link

veegee commented Apr 23, 2015

Where exactly is it in the readme?

@rivera-ernesto
Copy link
Member

Just follow the link.

CocoaLumberjack 2

Migrating to 2.x

  • Replace DDLog.h imports by #import <CocoaLumberjack/CocoaLumberjack.h>.
  • Using ddLogLevel to start using the library is now optional. If you define it add #define LOG_LEVEL_DEF ddLogLevel before #import <CocoaLumberjack/CocoaLumberjack.h> and make change its type to DDLogLevel

@MaddTheSane
Copy link
Contributor

The read-me is incorrect: the define must be on the command line for now, as the version of Clang included in Xcode 6.3 doesn't allow it to be defined in the source code. This may change in the future, but as it stands, it needs to be on the command line.

Sent from my iPad

On Apr 23, 2015, at 9:37 AM, Ernesto Rivera notifications@github.com wrote:

Just follow the link.

CocoaLumberjack 2

Migrating to 2.x

Replace DDLog.h imports by #import <CocoaLumberjack/CocoaLumberjack.h>.
Using ddLogLevel to start using the library is now optional. If you define it add #define LOG_LEVEL_DEF ddLogLevel before #import <CocoaLumberjack/CocoaLumberjack.h> and make change its type to DDLogLevel

Reply to this email directly or view it on GitHub.

@MaddTheSane
Copy link
Contributor

This happened when I made the pull request to use modules. One way to get around this is to turn off modules, but this would break Swift support.

Clang 3.7 added support for the textual header keyword, but Xcode 6.3 uses Clang 3.6, which doesn't. The textual header would make it so you could #define LOG_LEVEL_DEF ddLogLevel, but currently you will need to add LOG_LEVEL_DEF=ddLogLevel to your project's preprocessor macros.

Sorry.

@0xced
Copy link
Contributor

0xced commented May 22, 2015

The Dynamic Log Levels documentation is also incomprehensible because of this.

@rivera-ernesto
Copy link
Member

Most documentation hasn't been updated since 1.9.x.

@shawnmorrison
Copy link

Adding LOG_LEVEL_DEF=ddLogLevel to the Preprocessor Macros does not work for me. I get the same duplicate symbols error others have mentioned even though I'm not defining it elsewhere.

Has anything changed since the above comments?

Is there any documentation for exactly how to set this up correctly?

@DanSkeel
Copy link

@shawnmorrison hi, It seems like it got fixed in #539. You don't have to define it yourself anymore. Maybe you get duplicates because you define and assign ddLogLevel in a header and include it in multiple source files?

I made some macros helpers for myself, you can examine my approuch to get the idea of how to use Cocoa Lumberjack properly. (I hope I don't miss anything myself)

The key is to set ddLogLevel in a source file, not in a header.
If you want a global ddLogLevel you will have to use extern ddLogLevel

(You can set it in header file, of course, but you won't be able to change it individually for each file)

ospr added a commit to ospr/CocoaLumberjack that referenced this issue Mar 9, 2016
… #ifdef ddLogLevel was a bad idea and it created more issues than solved."

This reverts commit 932a65e.
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

9 participants