We are please to release logmongo into the public domain. This module allows programmers to easily log messages to a capped MongoDB collections. [sourcecode]
What does it do?
- Gracefully creates capped collections.
- Auto expires oldest records first and solves log rotation.
- Writes complex (dicts and kwargs) log records.
- Logs asynchronously.
- Collects logs locally or remotely or in a central location.
- Allows access to logs via MongoDB queries and APIs.
Installation
Simply use easy_install or pip:
easy_install logmongo
pip install logmongo
Why should I use Logmongo instead of just pymongo?
Logmongo subclasses the pymongo Collection object and provides the following additions -
- A new Logmongo object will:
-
- gracefully create a named capped collection
- allow a max size to be specified
- write method which:
-
- logs all passed keywords
- adds current time to record
- adds hostname to record
- query method which:
-
- allows keywords (kwargs) querying example: log.query( tags='finance' )
- tail method which:
-
- prints all records that match query until killed
How does it work?
Example:
from logmongo import Logmongo log = Logmongo() log.write( message='No required kwargs or fields!' ) entry = { 'tags':['but','we','like','tags'], 'level':'info' } log.write( entry ) # for more help check out help( logmongo )
License
Public Domain
How do I thank you?
Write me an email! I always respond back!