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

Pcvl 769 logging user documentation #452

Conversation

MarionQuandela
Copy link
Contributor

No description provided.

@MarionQuandela MarionQuandela marked this pull request as ready for review August 29, 2024 09:53
docs/source/reference/logging.rst Outdated Show resolved Hide resolved
docs/source/reference/logging.rst Outdated Show resolved Hide resolved
docs/source/reference/logging.rst Outdated Show resolved Hide resolved
docs/source/reference/logging.rst Outdated Show resolved Hide resolved
docs/source/reference/logging.rst Outdated Show resolved Hide resolved
docs/source/tools.rst Outdated Show resolved Hide resolved
perceval/utils/logging/config.py Outdated Show resolved Hide resolved
perceval/utils/logging/config.py Outdated Show resolved Hide resolved
perceval/utils/logging/config.py Outdated Show resolved Hide resolved
@@ -123,6 +126,15 @@ def _configure_logger(self):
exq_log.level.__members__[level],
exq_log.channel.__members__[channel])

def apply_config(self, config: LoggerConfig):
if config.python_logger_is_enabled():
self = PythonLogger()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you test this thoroughly, please?

- ``logger.warn``
- An indication that something unexpected happened, or indicative of some problem in the near future (e.g. ‘disk space low’). The software is still working as expected.
* - ERROR
- ``logger.error``
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems we called it "err" in exqalibur and not error :/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but the python logger module call it error. I think it's a good idea to keep the same interface :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I meant is: we use exqalibur.logger.level enum in Python, and exqalibur exposes the error level as exqalibur.logger.level.err which is exposed by Python as perceval.utils.logging.level.err

So isn't there an issue with the doc?

perceval/utils/logging/config.py Outdated Show resolved Hide resolved
docs/source/reference/logging.rst Outdated Show resolved Hide resolved

To log with Perceval you can either a built-in Perceval logger or the python one. By default, our logger will be used.

To have the perceval message log with the python logger, use this method:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To log the Perceval message logs with the python logger, use this method:

(the word log gets too repetitive I understand but 'have' seemed weird to me, maybe 'save'?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No because saving it means save it in a file, which is a differant notion

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To log a message with the Python logger, use:

docs/source/reference/logging.rst Outdated Show resolved Hide resolved
docs/source/reference/logging.rst Outdated Show resolved Hide resolved
docs/source/reference/logging.rst Outdated Show resolved Hide resolved
docs/source/reference/logging.rst Outdated Show resolved Hide resolved
docs/source/reference/logging.rst Outdated Show resolved Hide resolved
docs/source/reference/logging.rst Outdated Show resolved Hide resolved
docs/source/reference/logging.rst Outdated Show resolved Hide resolved
@@ -123,6 +126,13 @@ def _configure_logger(self):
exq_log.level.__members__[level],
exq_log.channel.__members__[channel])

def apply_config(self, config: LoggerConfig):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid the inability to change the logger type, from inside a given logger, you can define an apply_logger_config() function outside of the logger classes. It would remove both user warnings.


To log with Perceval you can either a built-in Perceval logger or the python one. By default, our logger will be used.

To have the perceval message log with the python logger, use this method:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To log a message with the Python logger, use:

@MarionQuandela MarionQuandela force-pushed the PCVL-769-logging-user-documentation branch from f956c39 to 2caba46 Compare September 5, 2024 17:50
@MarionQuandela MarionQuandela deleted the PCVL-769-logging-user-documentation branch September 19, 2024 15:01
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.

3 participants