Coder Social home page Coder Social logo

logme's Introduction

Logme - Python Logging for Humans

https://travis-ci.org/BNMetrics/logme.svg?branch=master Documentation Status

Logme is a Python package that makes logging simple and robust. If you have found logging in Python not so straight forward, download this package and give it a try! :)

V1.3.0 Updates

logme.ini file now supports custom datefmt and style! Thanks to @afunTW suggestion! :)

Here is an example of how you can specify these parameters in your logme.ini configuration:

[my_config]
level = DEBUG
formatter =
    fmt: {asctime} - {name} - {levelname} - {message}
    datefmt: %Y/%m/%d
    style: {
stream =
    type: StreamHandler
    active: True
    level: DEBUG
file =
    type: FileHandler
    active: True
    level: DEBUG
    formatter: {name} :: {funcName} :: {levelname} :: {message}
    filename: mylogpath/foo.log

Note: Only top level master_formatter supports parameters as shown above, individual handler formatter will not.

Terminal Color Output

logme supports color and styling output in the terminal!

The colors and style is customizable in logme.ini, here is a screenshot of how it looks like in the terminal:

http://logme.readthedocs.io/en/latest/_images/demo_color.png

To use color output in logme, make sure your logme package and logme.ini is up-to-date if you are using a version before 1.2.0.

Check the configuration details here.

In A Nutshell

If you have a function you want to log, you can do this in your python file:

import logme


@logme.log
def my_awesome_function(my_arg, logger=None):
    logger.info('this is my log message')
    """rest of the function"""

You can do the same with classes too:

import logme


@logme.log
class MyAwesomeClass:
    def my_function(self, my_arg):
        self.logger.info('this is my log message')

pretty nice right? :)

To get started, head to the quickstart page.

Installing Logme

$ pipenv install logme
โœจ๐Ÿฐโœจ

Documentation

You can find the documentation at https://logme.readthedocs.io/en/latest/ . Give it a try!

logme's People

Contributors

0xflotus avatar bagerard avatar bnmetrics avatar dependabot-preview[bot] avatar f-z avatar groodt avatar jugmac00 avatar kennethreitz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.