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-7.0.0.tar.gz (7.4 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-7.0.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for fense_logger-7.0.0.tar.gz
Algorithm Hash digest
SHA256 3e0cdf0caddb9fc5eef4131951481977c0cfaa24376e35edcc641ecbbd12deb6
MD5 79e54d0ad2a4d1c442390efd30c154dc
BLAKE2b-256 f010973fabed0a7b9cb5c1337e983772dff3e2cd098605843e835fc563263e54

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fense_logger-7.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fcdb85dde97675f57bb483d24738edd48f4f72a3a37dfaa82658a34ce234c226
MD5 02ac7682f8896818c201309ac6118966
BLAKE2b-256 1fe3b56c337f2326a1b9c11343ebba244e8d235c555d2ccdc66a1ad75eae596e

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