Commit d039868f authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

log: Add pr_quelled helper

If we need to check if current loglevel will suppress
our messagess (say you need to run pr_debug in a cycle)
we can use this helper to eliminate unneded calls.

Like
  if (!pr_quelled(LOG_DEBUG)) {
    ... do something specific to LOG_DEBUG ...
  }
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent c40eff85
......@@ -27,4 +27,9 @@ extern int write_pidfile(int pid);
extern void print_data(unsigned long addr, unsigned char *data, size_t size);
extern void print_image_data(int fd, unsigned int length, int show);
static inline int pr_quelled(unsigned int loglevel)
{
return log_get_loglevel() < loglevel && loglevel != LOG_MSG;
}
#endif /* __CR_LOG_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment