Skip to main content

how to use

1. define configuration and call set_logger method to start logging process in main

from process_logging.logger import Logger, HandlerType

logger = Logger()
log_fime_name = "{:%Y-%m-%d}_info.log".format(datetime.now())
log_path = "./logs/"
trf_handler_args = {"filename": log_path + log_fime_name,
                    "when": "midnight",
                    "interval": 1,
                    "encoding": "utf-8"}
format_def = ("[%(levelname)s] | %(process)d | %(asctime)s | %(message)s", "%Y-%m-%d %H:%M:%S")
handler_def = {HandlerType.StreamHandler: {}, HandlerType.TimedRotateFileHandler: trf_handler_args}

if __name__ == "__main__":
    logger.set_logger(name="logger", level=logging.INFO, handler_def=handler_def, format_def=format_def)

2. atfer set _logger, you can logging anywhere in your project with Logger()

@cbv(project_router)
class Router:
    def __init__(self):
        self._logger = Logger()

    @project_router.get(PREFIX)
    def test_func(self):
        # logging
        self._logger.logging(name="logger", level=logging.INFO, message="logging test")

3. result

[INFO] | 4147 | 2023-08-30 10:09:29 | logging test

Metadata

Release files for process-logging 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for process-logging 0.2.0
File Size Uploaded
process_logging-0.2.0.tar.gz 2.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for process-logging 0.2.0
File Interpreter ABI Platform
process_logging-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 5.9 kB

Release files / process_logging-0.2.0.tar.gz

Download URL process_logging-0.2.0.tar.gz
Size 2.8 kB
Tags Source
SHA-256 checksum
How to use checksums
769d21470fbdece9b1f58aacb81c410ce6dd68ddf98fd98a03a4de755be3a4ae
BLAKE2b-256 checksum
How to use checksums
f81939c18dc2b54d968cf657220464df425b4f7dd88908b8261950b3bdf233af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.5

Release files / process_logging-0.2.0-py3-none-any.whl

Download URL process_logging-0.2.0-py3-none-any.whl
Size 3.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bf3b113605701f0b8c5146d36ac4155441feac81068a20654ab080ffab33b58c
BLAKE2b-256 checksum
How to use checksums
bc1d30ed0a5cd8da5fb68e0332272b68c10aef68a432c37c87f57b4095eee5e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.5

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page