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

[WIP] Logging System 2.0 #23

Closed
wants to merge 19 commits into from
Closed

[WIP] Logging System 2.0 #23

wants to merge 19 commits into from

Conversation

Alleria1809
Copy link
Contributor

@Alleria1809 Alleria1809 commented May 21, 2024

  1. Updated the logging system, learn from pytorch lightning's logic
  2. Upload the corresponding documentation(API and tutorial, examples included)
    image
    image
    image

TODO:

  • Add color to the content console
  • Extend the base logger to more customized loggers
  • Multi-process environment? Async logging calls?

@Alleria1809
Copy link
Contributor Author

Maybe in the dev we should keep the docs/source/, not add in the .gitignore

utils/logger.py Outdated
Then you can open ./logs/app.log and view the content.
from utils import BaseLogger
import logging
base_logger = BaseLogger(filename='myapp.log', log_level=logging.DEBUG).logger
Copy link
Member

Choose a reason for hiding this comment

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

just call it logger =

import logging
import os
import sys
from typing import Optional
import structlog
Copy link
Member

Choose a reason for hiding this comment

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

remove structlog from the pyproject.toml

.. code-block:: python

#app.log
2024-05-20 22:08:28 - utils.logger - INFO - [hotpotqa.py:81] - question: Were Scott Derrickson and Ed Wood of the same nationality?
Copy link
Member

Choose a reason for hiding this comment

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

why do we need to show utils.logger there? not much information

How does the logging system work?
---------------------------------

Our logging system, built on Python’s versatile logging module, introduces a ``BaseLogger`` that simplifies logging setup. This ``BaseLogger`` facilitates both console and file outputs, with configurable ``file path``, ``file name`` and ``log level`.
Copy link
Member

Choose a reason for hiding this comment

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

even until this point, i only learned one thing: Lightrag log is built on top of default logging module, i have no idea the benefits

@Alleria1809
Copy link
Contributor Author

Close logging system PR because I combine it with the Document PR, so I can generate doc for it easily.

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.

2 participants