mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 06:15:24 +00:00
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: Cyrill Gorcunov <gorcunov@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
c40eff85dc
commit
d039868f99
@@ -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__ */
|
||||
|
Reference in New Issue
Block a user