irc
IRC module.
- class wmflib.irc.SocketHandler(host: str, port: int, username: str)[source]
Bases:
Handler
Log handler to communicate with logmsgbot.
Sends log events to a tcpircbot server for relay to an IRC channel. The combination of hostname:port identifies a specific IRC channel, and for the moment only the #wikimedia-operations one is configured. Please also keep in mind that SRE allows only specific hostnames to send traffic to tcpircbot, so follow up with them in case you have doubts or special requests. For more info, please check the tcpircbot config in puppet.
Examples
>>> import logging >>> from wmflib.interactive import get_username >>> from wmflib.irc import SocketHandler >>> irc_logger = logging.getLogger('irc_logger') >>> irc_logger.setLevel(logging.INFO) >>> irc_logger.addHandler(SocketHandler('irchost.domain', 1234, get_username())) >>> irc_logger.info('Message')
The tcpircbot that received the message will then send it to the configured IRC channel:
logmsgbot: user@host1001.domain Message
Initialize the IRC socket handler.