Skip to main content

Simple logging and benckmark decorator

Project description

Project logo

Kami Logging

Status GitHub release issues - kami-logging pulls - kami-logging License


Simple decorator to logging and benchmark functions

📝 Table of Contents

🧐 About

This package arose from the need to simplify the logging tasks of applications created by the Kami CO software development team.

Currently the package has 4 decorators: benchmark_with, logging_with, default_logging and default_benchmark for logging and basic performance testing with or without a defined logger object;

🏁 Getting Started

These instructions will get you a copy of the package and a daily use example.

Prerequisites

  • Python 3.x
  • logging library

Installing

$pip install kami-logging

🎈 Usage

The four decorators available are:

  • @logging_with: generates a log message of type info at the beginning and end of the function execution, using a logger object defined by the developer

  • @default_logging: generates a log message of type info at the beginning and end of function execution, using a default logger object named 'default'

  • @benchmark_with: Generates a log message of type info with the runtime of the function accurate to 3 decimal places, using a developer-defined logger object

  • @default_benchmark: generates a log message of type info with the runtime of the function accurate to 3 decimal places, using a default logger object named 'default'

import logging
from kami_logging import logging_with, benchmark_with

my_app_logger = logging.getLogger("my_app")

@benchmark_with(my_app_logger)
@logging_with(my_app_logger)
def my_func(*args, **kwargs):
  pass

Result:

Project logo

⛏️ Built Using

✍️ Authors

See also the list of contributors who participated in this project.

🎉 Acknowledgements

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

kami_logging-0.2.1.tar.gz (15.7 kB view hashes)

Uploaded Source

Built Distribution

kami_logging-0.2.1-py3-none-any.whl (16.0 kB view hashes)

Uploaded Python 3

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