All Projects → georgeyk → Belogging

georgeyk / Belogging

Licence: mit
Easy and opinionated logging configuration for Python apps

Programming Languages

python
139335 projects - #7 most used programming language
python3
1442 projects

Projects that are alternatives of or similar to Belogging

Litter
Litter is a pretty printer library for Go data structures to aid in debugging and testing.
Stars: ✭ 1,137 (+5585%)
Mutual labels:  library, logging
Humblelogging
HumbleLogging is a lightweight C++ logging framework. It aims to be extendible, easy to understand and as fast as possible.
Stars: ✭ 15 (-25%)
Mutual labels:  library, logging
Liblognorm
a fast samples-based log normalization library
Stars: ✭ 81 (+305%)
Mutual labels:  library, logging
Vlog
An in-display logging library for Android 📲
Stars: ✭ 86 (+330%)
Mutual labels:  library, logging
Go Grpc Middleware
Golang gRPC Middlewares: interceptor chaining, auth, logging, retries and more.
Stars: ✭ 4,170 (+20750%)
Mutual labels:  library, logging
Logging Log4j2
Apache Log4j 2 is an upgrade to Log4j that provides significant improvements over its predecessor, Log4j 1.x, and provides many of the improvements available in Logback while fixing some inherent problems in Logback's architecture.
Stars: ✭ 1,133 (+5565%)
Mutual labels:  library, logging
Logsip
A simple, concise, colorful logger for Go
Stars: ✭ 94 (+370%)
Mutual labels:  library, logging
Plog
Portable, simple and extensible C++ logging library
Stars: ✭ 1,061 (+5205%)
Mutual labels:  library, logging
Pygogo
A Python logging library with superpowers
Stars: ✭ 265 (+1225%)
Mutual labels:  library, logging
Golib
Go Library [DEPRECATED]
Stars: ✭ 194 (+870%)
Mutual labels:  library, logging
Java Markdown Generator
Java library to generate markdown
Stars: ✭ 159 (+695%)
Mutual labels:  library, logging
Faster
Fast persistent recoverable log and key-value store + cache, in C# and C++.
Stars: ✭ 4,846 (+24130%)
Mutual labels:  library, logging
Log Process Errors
Show some ❤️ to Node.js process errors
Stars: ✭ 424 (+2020%)
Mutual labels:  library, logging
Python Colorlog
A colored formatter for the python logging module
Stars: ✭ 676 (+3280%)
Mutual labels:  library, logging
Timesheet.js
JavaScript library for HTML5 & CSS3 time sheets
Stars: ✭ 6,881 (+34305%)
Mutual labels:  library
Rxsociallib
分享登录工具库,简洁配置,可配合RxJava/RxJava2使用,支持QQ微信微博
Stars: ✭ 15 (-25%)
Mutual labels:  library
Eliot
Eliot: the logging system that tells you *why* it happened
Stars: ✭ 874 (+4270%)
Mutual labels:  logging
Omgl
Pythonic OpenGL Bindings
Stars: ✭ 13 (-35%)
Mutual labels:  library
Serf
Mirror of Apache Serf
Stars: ✭ 15 (-25%)
Mutual labels:  library
Candyview
Implement any RecyclerView in just 1 Line. CandyView handles everything for you.
Stars: ✭ 15 (-25%)
Mutual labels:  library

Belogging

Don't fight with logging ...

|TravisCI Build Status| |Coverage Status| |PyPI Version| |PyPI License| |PyPI latest|


Easy logging configuration based on environment variables.

Features:

* Set logging level using environment variable LOG_LEVEL (defaults to 'INFO')
* Set which loggers to enable using environment variable LOGGERS (defaults to '', everything)
* Always output to stdout
* Optional JSON formatter
* Completely disable logging setting LOG_LEVEL=DISABLED

Requirements:

* Python 3.5 and beyond

Install:

`pip install belogging`

Examples:

Simple applications:


.. code-block:: python

    # my_script.py

    import belogging
    belogging.load()
    # ^^ this call is optional, only useful for customization
    # For example, to enable JSON output: belogging.load(json=True)

    # belogging.getLogger is just a sugar to logging.getLogger, you can
    # use logging.getLogger as usual (and recommended).
    logger = belogging.getLogger('foobar')
    logger.debug('test 1')
    logger.info('test 2')


Executing:

.. code-block:: bash

    # selecting LOG_LEVEL
    $ LOG_LEVEL=DEBUG python my_script.py
    # level=DEBUG message=test 1
    # level=INFO message=test 2

    # selecting LOGGERS
    $ LOGGERS=foobar python my_script.py
    # Both messages

    # Both
    $ LOGGERS=foobar LOG_LEVEL=INFO my_script.py
    # only level=INFO message=test 2


Applications should call ```belogging.load()``` upon initialization.
The first ```__init__.py``` would be a good candidate, but anything before any call to
```logging``` module will be fine.


Django:
~~~~~~~


In your projects ```settings.py```:

.. code-block:: python

    import belogging
    # Disable django logging setup
    LOGGING_CONFIG = None
    belogging.load()


Inside your code, just use ```logging.getLogger()``` as usual.

.. code-block:: bash

    $ export LOG_LEVEL=WARNING
    $ ./manage.py runserver
    # It will output only logging messages with severity > WARNING


Logging follows a hierarchy, so you easily select or skip some logging messages:


.. code-block:: bash

    $ export LOGGERS=my_app.critical_a,my_app.critical_c,my_lib
    $ ./my-app.py
    # "my_app.critical_b messages" will be skipped
    # all messages from my_lib will show up


.. |TravisCI Build Status| image:: https://travis-ci.org/georgeyk/belogging.svg?branch=master
   :target: https://travis-ci.org/georgeyk/belogging
.. |Coverage Status| image:: https://coveralls.io/repos/github/georgeyk/belogging/badge.svg?branch=master
   :target: https://coveralls.io/github/georgeyk/belogging?branch=master
.. |PyPI Version| image:: https://img.shields.io/pypi/pyversions/belogging.svg?maxAge=2592000
   :target: https://pypi.python.org/pypi/belogging
.. |PyPI License| image:: https://img.shields.io/pypi/l/belogging.svg?maxAge=2592000
   :target: https://pypi.python.org/pypi/belogging
.. |PyPI latest| image:: https://img.shields.io/pypi/v/belogging.svg?maxAge=2592000
   :target: https://pypi.python.org/pypi/belogging
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].