in azure_functions_worker/dispatcher.py [0:0]
def on_logging(self, record: logging.LogRecord,
formatted_msg: str) -> None:
if record.levelno >= logging.CRITICAL:
log_level = protos.RpcLog.Critical
elif record.levelno >= logging.ERROR:
log_level = protos.RpcLog.Error
elif record.levelno >= logging.WARNING:
log_level = protos.RpcLog.Warning
elif record.levelno >= logging.INFO:
log_level = protos.RpcLog.Information
elif record.levelno >= logging.DEBUG:
log_level = protos.RpcLog.Debug
else:
log_level = getattr(protos.RpcLog, 'None')
if is_system_log_category(record.name):
log_category = protos.RpcLog.RpcLogCategory.Value('System')
else: # customers using logging will yield 'root' in record.name
log_category = protos.RpcLog.RpcLogCategory.Value('User')
log = dict(
level=log_level,
message=formatted_msg,
category=record.name,
log_category=log_category
)
invocation_id = get_current_invocation_id()
if invocation_id is not None:
log['invocation_id'] = invocation_id
self._grpc_resp_queue.put_nowait(
protos.StreamingMessage(
request_id=self.request_id,
rpc_log=protos.RpcLog(**log)))