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

Issue with _DISABLE_DEBUG_LOGS ver 8.91, vs2010 #249

Closed
anurag-daware opened this issue Feb 9, 2015 · 15 comments
Closed

Issue with _DISABLE_DEBUG_LOGS ver 8.91, vs2010 #249

anurag-daware opened this issue Feb 9, 2015 · 15 comments
Labels

Comments

@anurag-daware
Copy link

I have added this macro in myinclude.h header file which includes easyloggingpp library.
Then in main.cpp I have initialzed the library.
in main function, I have added 3 logs as:
LINFO << "GUI Mode";
LDEBUG << "GUI Mode";
LERROR << "GUI Mode";
LWARNING << "GUI Mode";
After adding this macro in header file myinclude.h, all above logs are getting printed.
What I am missing here?

@anurag-daware anurag-daware changed the title Issue with _DISABLE_DEBUG_LOGS ver 8.91 Issue with _DISABLE_DEBUG_LOGS ver 8.91, vs2010 Feb 9, 2015
@abumq
Copy link
Owner

abumq commented Feb 9, 2015

can you define it in makefile (or while compiling) -D_DISABLE_DEBUG_LOGS also you need _DEBUG (which is defined by default when compiling in debug mode, see your compiler's command line args)

@abumq
Copy link
Owner

abumq commented Feb 9, 2015

oh in VS2010 ensure you do not have NDEBUG defined .. see http://stackoverflow.com/questions/2290509/debug-vs-ndebug

@anurag-daware
Copy link
Author

"can you define it in makefile (or while compiling) -D_DISABLE_DEBUG_LOGS also you need _DEBUG (which is defined by default when compiling in debug mode, see your compiler's command line args)"

If I build in release mode, NDEBUG is defined. If I build in debug mode _DEBUG is defined by build config.
Also, -D_DISABLE_DEBUG_LOGS is different than _DISABLE_LOGS?

@anurag-daware
Copy link
Author

I have added condition like this in header file:
#if defined(_DEBUG)
//define some debug related macros
#else
-D_DISABLE_DEBUG_LOGS
#endif

@abumq
Copy link
Owner

abumq commented Feb 9, 2015

_DISABLE_LOGS disables all the levels whereas _DISABLE_DEBUG_LOGS only disables debug level

@anurag-daware
Copy link
Author

I got the issue.
It was due to selection of runtime library.
http://stackoverflow.com/a/20571018/1697530
I used switch /MD instead of /MDd.
Now it is working.

@anurag-daware
Copy link
Author

Now what is happening is,
if I use /MDd switch my project builds fine.
If I use /MD switch, I get lot of errors as:
syntax error : 'unsigned __int64' should be preceded by ';
for many header files.
This is new issue faced my me.
Do I need to raise new issue?

@anurag-daware
Copy link
Author

I found this is happening because,
I had included easyloggin++.h in precompiled header file.
I moved to normal header file and the erros are gone.

@abumq
Copy link
Owner

abumq commented Feb 9, 2015

I don't maintain v8.91 anymore, so if you find any error you can fork and make changes to the local repo :) this is a stable version and find it hard to keep two versions going on; so from version 9.xx i have used c++11 features

@anurag-daware
Copy link
Author

Ok, actually, I am not able to _DISABLE_DEBUG_LOGS macro properly.
Where should this macro is to be added?
I am getting error as _DISABLE_DEBUG_LOGS is undefined.

@abumq
Copy link
Owner

abumq commented Feb 9, 2015

why do you use macro? why not disable logs via configuration? more feasible, any way if you still want to do it, you need to define at high level (using -D flag - not sure about vc++ i think it's in compiler preferences - may be https://msdn.microsoft.com/en-us/library/f2t8ztwy(v=vs.90).aspx ? )

@anurag-daware
Copy link
Author

My requirement is, I need to disable debug logs for release build and enable for debug build.
While setting configuration, I need to check type of build right?
What I am doing is if (_DEBUG) is not defined, I am defining macro as:
#if defined(_DEBUG)
#else
#define _DISABLE_DEBUG_LOGS 1
#endif

How do we achieve same using configuration?
How to use 'easyloggingpp::ConfigurationType::Enabled' to disable particular level?

@abumq
Copy link
Owner

abumq commented Feb 10, 2015

Please see https://github.com/easylogging/easyloggingpp/tree/389a6e448097a4a5c7d30152d248c63c1087d15a#configuration-file and i dont think you need to check for _DEBUG as library does it internally

@abumq
Copy link
Owner

abumq commented Feb 18, 2015

update?

@anurag-daware
Copy link
Author

It is working fine as you commented.
Thanks for the help.
closing.

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

No branches or pull requests

2 participants