Skip to main content

m-formatter-logging là thư viện python để write log cho các module BackEnd-Mobio

Version:

Phiên bản hiện tại 1.0.6

Cài đặt:

pip3 install m-formatter-logging

Sử dụng:

  1. Gọi func log tương ứng với level mong muốn.
  • Sử dụng tham số sensitive=True (default=False) trong trường hợp dữ liệu log có data nhạy cảm (Ví dụ: thông tin PII của profile, mật khẩu của user, mã voucher,...).
  • Sử dụng key extra để log thêm thông tin (chỉ show trên hệ thống ELK).
if __name__ == '__main__':
    def test():
        MobioLogging().info('app_test_lib_logging::test():info', sensitive=True, extra={"key1": "value1"})
        try:
            a = 1 / 0
            MobioLogging().info('__init__::test():a: %s' % a)
        except Exception as ex1:
            MobioLogging().error('app_test_lib_logging::test():error: %s' % ex1, sensitive=True)

        MobioLogging().debug('app_test_lib_logging::test():debug')
        MobioLogging().warning('app_test_lib_logging::test():warning', sensitive=False)

    test()
  1. Sử dụng file custom config:
config_file_path = 'path/to/config/file'
MobioLogging().file_config(self, config_file_path)
  1. Sử dụng custom filter để xử lý cụ thể 1 trường hợp log:
class CustomizeFilterRecords():
    def filter(self, record):
        if record.key1 == 'value1':
            return False # no log
        return True

MobioLogging().logger.addFilter(CustomizeFilterRecords())

Changelog:

v1.0.6:
  • Bỏ fix version dependency configparser
v1.0.4:
  • Cập nhật lại mô tả trong README.
v1.0.3:
  • Phiên bản đầu tiên.

Metadata

Release files for m-formatter-logging 1.0.6

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

Source distribution (sdist)

Source distribution for m-formatter-logging 1.0.6
File Size Uploaded Provenance
m-formatter-logging-1.0.6.tar.gz 4.4 kB Without provenance Details

Release files / m-formatter-logging-1.0.6.tar.gz

Download URL m-formatter-logging-1.0.6.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a448aabfb62e178f6309b496fc37c72ce5dfcba0266acc05e2da83d90064c6e9
BLAKE2b-256 checksum
How to use checksums
812776df8db43dc3c68a800c73dfb5a2263f34b1c78aaedbbd5e62b190391641
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.7

Security for m-formatter-logging 1.0.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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