How to get the current set LOG_MASK in Python's syslog module?

Dennis Lee Bieber wlfraed at ix.netcom.com
Thu Sep 22 21:55:18 EDT 2022


On Thu, 22 Sep 2022 13:28:57 +0000, c.buhtz at posteo.jp declaimed the
following:


>I would like to get the current `LOG_MASK`, which is kind of a logging 
>level. According to the docu it seems that `syslog` doesn't have a 
>mechanism for that.
>

	There is a function .LOG_MASK() but it seems to just return 2^arg

>>> import syslog
>>> syslog.LOG_MASK(1)
2
>>> syslog.LOG_MASK(2)
4
>>> syslog.LOG_MASK(3)
8
>>> syslog.LOG_MASK(4)
16
>>> syslog.LOG_MASK(0)
1
>>> syslog.LOG_MASK(256)
1
>>> syslog.LOG_MASK(16)
65536
>>> syslog.__doc__
>>> syslog.LOG_MASK(17)
131072
>>> syslog.LOG_MASK(32)
1
>>> syslog.LOG_MASK(24)
16777216
>>>

	That is in the Windows Linux (Debian) subsystem.


>Does someone has an idea?
>
>The docu also tells me that `syslog` does let pass all messages by 
>default.
>My point is I do manipulate via `syslog.setlogmask()` the current log 
>leve. At the end I would like to set it back to its previous value.
>
>Kind


-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
	wlfraed at ix.netcom.com    http://wlfraed.microdiversity.freeddns.org/


More information about the Python-list mailing list