From reading the docs about logging, I know I can use the basicConfig
for example to set the format of logging records, such as:
import logging
logging.basicConfig(format="%(levelname)s - %(message)s")
for example.
My question is, can I specify different formats for different levels? What I'm trying to achieve is to format logging records to Azure Pipelines logging commands so that for examle the Python code:
logging.error("some error")
Will be printed as:
##[error]some error
Now I know I can use the %(levelname)
but I don't want to rely on the correspondence between Azure Pipelines logging commands to Python's "logging" module. For example, in Python's logging there's info
level, but not in Azure Pipelines.