Easy to use
logt.py
from loguru import logger
import logging
import logging.handlers
import os
def main():
handler = logging.handlers.SysLogHandler(address='/dev/log')
logger.add(handler, format="{level} | {message}")
logger.info("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
if __name__ == '__main__':
main()
# tail -f /var/log/messages
Dec 31 20:11:00 localhost journal[42166]: INFO | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Recommended Posts