Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing: Add type annotations to common/logging #6714

Merged
merged 1 commit into from
Jun 11, 2024

Conversation

rdimaio
Copy link
Contributor

@rdimaio rdimaio commented Apr 22, 2024

Part of #6588

On the ECS_FIELDS and LOG_RECORDS change, here's an execution of that code to show that the final BUILTIN_FIELDS is the same as before:

>>> from typing import TYPE_CHECKING, Any, Literal, Optional, Union, get_args
>>> ECS_FIELDS = Literal[
...     '@timestamp',
...     'message',
...     'log.level',
...     'log.origin.function',
...     'log.origin.file.line',
...     'log.origin.file.name',
...     'log.logger',
...     'process.pid',
...     'process.name',
...     'process.thread.id',
...     'process.thread.name'
... ]
>>>
>>> LOG_RECORDS = Literal[
...     'asctime',
...     'message',
...     'levelname',
...     'funcName',
...     'lineno',
...     'filename',
...     'name',
...     'process',
...     'processName',
...     'thread',
...     'threadName'
... ]
>>>
>>> BUILTIN_FIELDS = tuple((x, y) for x,y in zip(get_args(ECS_FIELDS), get_args(LOG_RECORDS)))
>>> BUILTIN_FIELDS
(('@timestamp', 'asctime'), ('message', 'message'), ('log.level', 'levelname'), ('log.origin.function', 'funcName'), ('log.origin.file.line', 'lineno'), ('log.origin.file.name', 'filename'), ('log.logger', 'name'), ('process.pid', 'process'), ('process.name', 'processName'), ('process.thread.id', 'thread'), ('process.thread.name', 'threadName'))

lib/rucio/common/logging.py Show resolved Hide resolved
lib/rucio/common/logging.py Show resolved Hide resolved
@bari12 bari12 merged commit e5806e1 into rucio:master Jun 11, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants