Skip to main content

Python library for convenient and beautiful logging of information

Project description

tinLogging

tinLogging is a versatile logging library for Python that provides a range of functionalities to enhance your application's logging capabilities.

Features

  • Supports multiple logging levels: DEBUG, INFO, WARNING, ERROR, CRITICAL
  • Ability to log HTTP requests with detailed information.
  • Export logs to JSON and HTML formats for easy analysis.
  • Log rotation and archiving to manage log file sizes efficiently.
  • Log statistics

Installation

Install tinLogging with pip using the following command:

pip install tinLogging

Quick Start

Here's how you can get started with tinLogging:

from tinLogging import Logger

logger = Logger()  # Creating a class object

# Writing logs to a file
logger.debug('This is a debug message')
logger.info('This is an info message')
logger.warning('This is a warning')
logger.error('This is an error message')
logger.critical('This is a critical message')

Documentation

tinLogging is a robust logging library for Python applications, offering a wide range of functionalities to enhance logging capabilities. It simplifies event tracking, debugging, and application behavior analysis.

Getting Started

Installation

To install tinLogging, run the following command:

pip install tinLogging

Basic Usage

To begin using tinLogging, import the Logger class and create an instance:

from tinLogging import Logger
logger = Logger()

Logging Messages

tinLogging supports various logging levels. Here's how to log messages at different levels:

logger.debug('This is a DEBUG level message')
logger.info('This is an INFO level message')
logger.warning('This is a WARNING level message')
logger.error('This is an ERROR level message')
logger.critical('This is a CRITICAL level message')

HTTP Request Logging

tinLogging can log HTTP requests with detailed information:

logger.http(200, 'OK', 'https://example.com/api')

Exporting Logs

You can export logs to JSON or HTML formats:

logger.export_json('exported_logs.json')
logger.export_html('exported_logs.html')

Advanced Features

Log Rotation

tinLogging can rotate logs when the file size reaches a specified limit:

logger.rotate_logs(max_megabytes_size=10)

Deleting Old Logs

You can delete logs older than a specified number of days or hours:

logger.deleting_old_logs(days=7)

Archiving Logs

tinLogging can archive and delete old logs:

Logger.archive_logs('logs.txt', 'logs_archive.zip')

Monitoring Log Size

tinLogging can monitor the log file size and send a warning if it exceeds a certain limit:

logger.monitor_log_size(max_megabytes_size=8)

Console Logging

tinLogging also includes a ConsoleLogger for logging messages to the console with color coding:

from tinLogging import ConsoleLogger

console_logger = ConsoleLogger(debug_color = 'Blue')
console_logger.debug('This is a debugging message')

Conclusion

tinLogging is a powerful tool for managing application logs. With its user-friendly interface and extensive features, it's an excellent choice for developers looking to implement robust logging in their Python applications

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

tinlogging-0.0.1.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

tinLogging-0.0.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file tinlogging-0.0.1.tar.gz.

File metadata

  • Download URL: tinlogging-0.0.1.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for tinlogging-0.0.1.tar.gz
Algorithm Hash digest
SHA256 dc73a8b48094681c73f7b99d685f8f2e0bd863f497f05a816123e3b42d9fbb33
MD5 710be792cada1c4ed21e4421a1b81c06
BLAKE2b-256 8e0f8bca8924ba50a53224f56a4decfc3dd87d8cf3f08348736d187cf5c22940

See more details on using hashes here.

File details

Details for the file tinLogging-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: tinLogging-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for tinLogging-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 247c83486fd5ed58009881a01987ff68a939686f0be87583dcd2426caf8d9461
MD5 a3ea147ee38e664064830e98f79a59ba
BLAKE2b-256 8b6dd8ac20dcf8c16edb4c751f7cf3157cada7e7ae9ce33586c5d8ee7cad3f67

See more details on using hashes here.

Supported by

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