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

zlog features #44

Closed
akildsouza opened this issue Oct 11, 2013 · 3 comments
Closed

zlog features #44

akildsouza opened this issue Oct 11, 2013 · 3 comments

Comments

@akildsouza
Copy link

  1. Is it possible to completely disable logging in zlog at compile/run time leading to zero performance overhead? If yes, how?
  2. Does zlog supports crash handling(signal handling)
@HardySimpson
Copy link
Owner

  1. At compile time, you can redefine macros in zlog.h, to make all the logging macros to be null. It will be zero cost.At run time, zlog its self is optimized by a bitmap operation:

    #define zlog_category_needless_level(a_category, lv) \
    !((a_category->level_bitmap[lv/8] >> (7 - lv % 8)) & 0x01)
    

    This is the only cost of a logging statement whose log level is disabled.

2.zlog api is thread safe, but not reentrant. But in real product code, you can use zlog api in signal handle function.
I think about output code stack when a process crashes, but found that just linux provide such api.

   int backtrace(void **buffer, int size);
   char **backtrace_symbols(void *const *buffer, int size);
   void backtrace_symbols_fd(void *const *buffer, int size, int fd);

@akildsouza
Copy link
Author

Can I use zlog free of cost with or without modifications to it in my applications?

@HardySimpson
Copy link
Owner

Sure you can, just obey the LGPL lience

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