Git Product home page Git Product logo

threepio's Introduction

threepio

Minimally improved noise for python.

Pragmatic, minimal logging for python.

Install

pip install git+git://github.com/jmatt/threepio

Use

Just initialize and go.

In [1]: import logging

In [2]: import threepio

In [3]: threepio.initialize(log_filename="./c3po.beep",
                            logger_name="super serial project",
                            app_logging_level=logging.DEBUG,
                            dep_logging_level=logging.WARN)
Out[3]: <logging.Logger at 0x106bc4ed0>

In [4]: from threepio import logger as c3po

In [5]: c3po.debug("BEEP!")

In [6]: c3po.info("ManBearPig Exists!")
#
# In c3po.log
# 2013-05-01 22:29:47,548 super serial project-DEBUG [<ipython-input-5-b81c1c01169e> 1] BEEP!
# 2013-05-01 22:30:01,372 super serial project-INFO [<ipython-input-6-089fe0b5bf92> 1] ManBearPig Exists!

Or create a custom logger and leave the global logger alone.

In [1]: import logging
In [2]: import threepio
In [3]: woot_logger = threepio.initialize(logger_name="woot",
    app_logging_level=logging.DEBUG,
    dep_logging_level=logging.DEBUG,
    global_logger=False)
In [4]: woot_logger.debug("RWRAharhrhr!")
#
# In the default logging file (threepio.log)
# 2013-05-01 22:14:06,215 woot-DEBUG [<ipython-input-6-3066a630384a> 1] RWRAharhrhr!

[Luke, Leia and Han start laughing hysterically; it sounds like screaming]

C-3PO: Listen to them, they're dying R2! Curse my metal body, I wasn't fast enough, it's all my fault! My poor Master.

Luke: 3PO, we're all right! We're all right! Ha ha! Hey, open the pressure maintenance hatch on unit number... where are we? 3263827!

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.