Hi, I’m currently using this to log my python process

logging.basicConfig(filename='filename.log', level=logging.DEBUG)

logger = logging.getLogger()

sys.stderr.write = logger.error

sys.stdout.write = logger.info

And then using print(f’{datetime.now()} log message’) where I want to log.

It’s working OK, buy I would like to live it to ic, but can’t find any info on how to send the ic output to the logger.

Thanks for any help.

  • cbarrick@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    edit-2
    6 months ago

    Just to confirm, if you change ic('test') to logger.debug('test') it works as expected? I.e. it creates the log file?

    Edit: Also if you change the output format of the logger and use it as the outputFunction to ic, does it include the customized format?

    I just want to confirm if your ic is routing through the logger or not, to know if it’s a problem with your logging config or with ic.