Set the logging level globally where the actor is created.
Code example:
import logging
from clu import AMQPClient
from sdsstools.logger import StreamFormatter
amqpc = AMQPClient(name="hello") # works also for AMQPActor
amqpc.log.sh.formatter = StreamFormatter(fmt='%(asctime)s %(name)s %(levelname)s %(filename)s:%(lineno)d: \033[1m%(message)s\033[21m')
amqpc.log.sh.setLevel(logging.DEBUG)
logger = amqpc.log
logger.debug('This is a message!')
logger.info('This is a message!')
logger.warning('This is a message!')
logger.error('This is a message!')
logger.critical('This is a message!')
Inside the AMQPActor you have to use self instead of an instance.
Its also possible to get the actor logger through the name of the Actor with a preifx"clu:"
Code example:
Inside the AMQPActor you have to use self instead of an instance.
Its also possible to get the actor logger through the name of the Actor with a preifx"clu:"
*If you wanna use the logger inside the commands section, you can retrieve the actor logger from command: Command.
logger = command.actor.log