Code Monkey home page Code Monkey logo

flog's Introduction

flog

Fast access to some simple python logging tricks

BuildImage

Latest PyPI version Number of PyPI downloads

Installation

Either find flog on PyPI or install it with pip or easy_install

pip install flog
#or
easy_install flog

Basic Usage

Getting a logger: import flog, get a logger with flog.get_logger(__name__)

Logging calls: in and out Get a logger, decorate functions with flog.log_call(<your logger>)

Logging calls with sensitive args (such as passwords): Get a logger, decorate functions with flog.log_sensitive_call(<your logger>)

(new in version 0.1.0) In production environments, you may wish to run with the environment variable FLOG_NOWRAP set truthy. This will make flog.log_call and flog.log_sensitive_call exit as quickly as possible and not attempt to emit DEBUG-level statements. This can also be accomplished by running the interpreter in "optimized" mode (python -O <your entry> or by setting the PYTHONOPTIMIZE environment variable)

(new in version 0.2.0) flog.log_call and flog.log_sensitive_call both now optionally take a callable that will be called with logger-compatible arguments. Suggested uses would be to log at a higher-than-debug level, or piping into another stream handler.

(new in version 0.3.0) CorrelationLoggerAdapter to assist in adding log correlation ids. Use it with flog.CorrelationLoggerAdapter(logger, {"correlation_id": cid}) where cid is some correlation id.

License

This software is hereby released under the MIT License, as seen in the LICENSE file

flog's People

Contributors

mitgr81 avatar mdhalse avatar movermeyer 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.