Skip to main content

Common thefense Custom Logging to OpenSearch or Console or Rotating File

Project description

Fense_Logger

Fense-Logger is a python library for logging in various targets like console, opensearch, file or mysql

Installation

Use the package manager [pip] to install fense-logger

pip install fense-logger

Usage

from fenselogger.common.logconfig import LoggerConfig from fenselogger.core import ExtraLog, LogManager

cfg = LoggerConfig() cfg.add_target("console", LoggerConfig.make_console(enabled=True)) cfg.add_target("file", LoggerConfig.make_file(log_dir="./logs", filename="app.log", enabled=True)) cfg.add_target("opensearch",LoggerConfig.make_opensearch(host="https://logging.testorg.com",port=9200,user="username",password="pwd",index="indexname",enabled=False,),)

log_manager = LogManager(cfg) logger = log_manager.get_logger()

one = ExtraLog() one.tenant_id = "tenA11" one.correlation_id = 11 one.customer_name = "Sun Systems" one.provider_name = "Fortuna Cysec" one.key_data["Status"] = "Queued" one.key_data["Something"] = "Another things"

logger.info("Queue Completed",extra={"extra": one},)

two = ExtraLog() two.tenant_id = "ten22" two.correlation_id = 12 two.customer_name = "Micros" two.provider_name = "Fortuna Cysec" logger.debug("Dicsovery Scanning Started",extra={"extra": two},)

logger.error("Queue Error",extra={"extra": one},) logger.warning("FK error found",extra={"extra": two},)

log_manager.stop()

Contributing

Pull requests are welcome. For major changes, please connect to main contributor to discuss and change

Please make sure to update tests as appropriate

License

For internal usage of thefense Platform

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fense_logger-6.0.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fense_logger-6.0.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file fense_logger-6.0.0.tar.gz.

File metadata

  • Download URL: fense_logger-6.0.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.4

File hashes

Hashes for fense_logger-6.0.0.tar.gz
Algorithm Hash digest
SHA256 edb5a7525581a55deab7bfa240065650d564c46e262b1809c4bee7d79fb37697
MD5 f44c796652769dedec63951f3eebbd2e
BLAKE2b-256 c199ab516adb21599a0d2e748b86fe45b83b20b1fe32375e84fbf252fd126f9c

See more details on using hashes here.

File details

Details for the file fense_logger-6.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fense_logger-6.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 495d3d6c7761c48020260b2b88f3d19eea6323a997955f1e43d587d7eca93387
MD5 16474fbced3e96fd5f1136a1842e2d0b
BLAKE2b-256 79ce41c706d879bf7ec9414fa7221b98d54baed539380a4af12a3748f19d147e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page