setlogmask() linux

来源:http://www.gnu.org/software/libc/manual/html_node/setlogmask.html

The symbols referred to in this section are declared in the file syslog.h.

— Function: int  setlogmask ( int mask)

setlogmask sets a mask (the “logmask”) that determines which future syslog calls shall be ignored. If a program has not called setlogmasksyslog doesn't ignore any calls. You can use setlogmask to specify that messages of particular priorities shall be ignored in the future.

setlogmask call overrides any previous setlogmask call.

Note that the logmask exists entirely independently of opening and closing of Syslog connections.

Setting the logmask has a similar effect to, but is not the same as, configuring Syslog. The Syslog configuration may cause Syslog to discard certain messages it receives, but the logmask causes certain messages never to get submitted to Syslog in the first place.

mask is a bit string with one bit corresponding to each of the possible message priorities. If the bit is on, syslog handles messages of that priority normally. If it is off, syslogdiscards messages of that priority. Use the message priority macros described in syslog; vsyslog and the LOG_MASK to construct an appropriate mask value, as in this example:

          LOG_MASK(LOG_EMERG) | LOG_MASK(LOG_ERROR)

or

          ~(LOG_MASK(LOG_INFO))

There is also a LOG_UPTO macro, which generates a mask with the bits on for a certain priority and all priorities above it:

          LOG_UPTO(LOG_ERROR)

The unfortunate naming of the macro is due to the fact that internally, higher numbers are used for lower message priorities.


注:priorities 是facilities 和levels的组合


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值