Skip to main content

A simple method decorator to generate logs easily.

Project description

LoggingDecorator

Status GitHub Issues GitHub Pull Requests License

A simple way to log your Python methods.

About

LoggingDecorator is a MIT licensed general-purpose software package written in Python that simplyfies the task of logging methods of other Python scripts.

Getting Started

To install this package you can just type in your Python terminal:

pip install logging-decorator

Prerequisites

This Python package only works with Python 3.6 or later.

Usage

The simplest use case is logging a generic method and displaying the log on screen.

from LoggingDecorator import logd

@logd
def foo():
  print('foo method')

def main():
  foo()

if __name__ == '__main__'
  main()

Features

  • Generate .log files inside a log folder in the current working directory.
from LoggingDecorator import logd

@logd(file=True)
def foo():
  print('foo method')

def main():
  foo()

if __name__ == '__main__'
  main()
  • Continue running the script if an exeception is raised:
from LoggingDecorator import logd

@logd(raise_exception=False)
def foo():
  print('foo method')

def main():
  foo()

if __name__ == '__main__'
  main()

Authors

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

logging-decorator-1.0.1.tar.gz (4.8 kB view hashes)

Uploaded Source

Built Distribution

logging_decorator-1.0.1-py3-none-any.whl (5.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