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

Encapsulate log interface selection #15

Open
elfring opened this issue Feb 11, 2019 · 4 comments
Open

Encapsulate log interface selection #15

elfring opened this issue Feb 11, 2019 · 4 comments

Comments

@elfring
Copy link

elfring commented Feb 11, 2019

Conditional compilation was introduced for a possible logging software.
This software adjustment had the consequence that preprocessor statements were distributed in the code base.
Thus I suggest to reduce unwanted code duplication.

  • Dedicated macros can help.
  • Will advanced class templates become safer for this use case?
@aesophor
Copy link
Owner

aesophor commented Aug 17, 2019

Previously:

#if GLOG_FOUND != FALSE
    LOG(INFO) << "Failed to open display to X server.";
#endif

With the help of this macro, it can be written in one line now.

WM_LOG(INFO, "Failed to open display to X server.");

If glog is not installed, then this macro will be expanded into an empty statement instead.

@elfring
Copy link
Author

elfring commented Aug 17, 2019

Thanks for another software improvement.
I am curious if these logging interfaces will evolve any further.

@aesophor
Copy link
Owner

  • Will advanced class templates become safer for this use case?

You have mentioned templates, do you mean something like: WM_LOG<INFO>("Some cool messages")

I guess this will need a dedicated templated function and template specialization.

@elfring
Copy link
Author

elfring commented Aug 23, 2019

Do you get any further development ideas from a library like spdlog?

aesophor referenced this issue Aug 28, 2019
Since it is unnecessary for these error message strings to stay in .data
for the entire program's lifetime.
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