• Stars
    star
    144
  • Rank 255,590 (Top 6 %)
  • Language
    Python
  • Created over 11 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Application instrumentation and logging, with a geological bent.

lithoxyl

Application instrumentation and logging, with a geological bent. Documentation is available on Read the Docs.

An infomercial of sorts

"Has this ever happened to you?"

Here's an example of some ostensibly well-instrumented code.

import logging

def create_user(name):
    logging.info('creating user with name %r', name)
    try:
        success = _create_user(name)
        if success:
            logging.info('successfully created user %r', name)
        else:
            logging.error('failed to create user %r', name)
    except Exception:
        logging.critical('exception encountered while creating user %r',
                         name, exc_info=True)
    return success

Notice how the logging statements tend to dominate the code, almost drowning out the meaning of the code.

Here's lithoxyl's take:

from lithoxyl import stderr_log

def create_user(name):
    with stderr_log.critical('user creation', username=name, reraise=False) as r:
        success = _create_user(name)
        if not success:
            r.failure()
    return success

Feature brief

  • Transactional logging
  • Semantic instrumentation
  • Pure Python
  • Pythonic context manager API minimizes developer errors
  • Decorator syntax is convenient and unobtrusive
  • Human-readable structured logs
  • Reparseability thanks to autoescaping
  • Statistical accumulators for prerolled metrics
  • Programmatic configuration with sensible defaults just an import away
  • Synchronous mode for simplicity
  • Asynchronous operation for performance critical applications
  • Log file headers for metadata handling
  • Heartbeat for periodic output and checkpointing
  • Automatic, fast log parser generation (TBI)
  • Sinks
    • EWMASink
    • DebuggerSink
    • MomentSink
    • QuantileSink
    • StreamSink
    • SyslogSink
    • and more

Reasons to use Lithoxyl

  • More specific: distinguishes between level and status
  • Safer: Transactional logging ensures that exceptions are always recorded appropriately
  • Lower overhead: Lithoxyl can be used more places in code (e.g., tight loops), as well as more environments, without concern of excess overhead.
  • More Pythonic: Python's logging module is a port of log4j, and it shows.
  • No global state: Lithoxyl has virtually no internal global state, meaning fewer gotchas overall
  • Higher concurrency: less global state and less overhead mean fewer places where contention can occur
  • More succinct: Rather than try/except/finally, use a simple with block
  • More useful: Lithoxyl represents a balance between logging and profiling
  • More composable: Get exactly what you want by recombining new and provided components
  • More lightweight: Simplicity, composability, and practicality, make Lithoxyl something one might reach for earlier in the development process. Logging shouldn't be an afterthought, nor should it be a big investment that weighs down development, maintenance, and refactoring.

More Repositories

1

awesome-python-applications

💿 Free software that works great, and also happens to be open-source Python.
Jupyter Notebook
16,672
star
2

boltons

🔩 Like builtins, but boltons. 250+ constructs, recipes, and snippets which extend (and rely on nothing but) the Python standard library. Nothing like Michael Bolton.
Python
6,473
star
3

glom

☄️ Python's nested data operator (and CLI), for all your declarative restructuring needs. Got data? Glom it! ☄️
Python
1,829
star
4

calver

📅 The web's go-to resource for Calendar Versioning info.
CSS
438
star
5

zerover

0️⃣ Minimalist versioning scheme for devs who can't be bothered.
CSS
168
star
6

clastic

🏔️ A functional web framework that streamlines explicit development practices while eliminating global state.
Python
155
star
7

ashes

⚱️ Lightweight, self-contained templating for Python 2 and 3, a la Dust templates
Python
56
star
8

espymetrics

EspyMetrics is a pure-Python analytics service that tracks Python usage. It is the reference project for Enterprise Software with Python.
Python
51
star
9

wapiti

Wikipedia API wrapper for humans and elk. (en.wikipedia.org/w/api.php, get it?)
Python
36
star
10

apatite

Awesomer awesome list management and analysis, originally designed for Awesome Python Applications: https://github.com/mahmoud/awesome-python-applications
Python
36
star
11

skeleton_sticky_footer

A minimally-enhanced version of the Skeleton 2.0.4 basic example with a sticky footer.
CSS
24
star
12

chert

Sharp and sparky static site generation.
Python
22
star
13

face

🗿 Straightforward CLI parsing and dispatching microframework
Python
21
star
14

glompad

JavaScript
6
star
15

ipynb-ftw

IPython notebooks automatically pulled from my server.
Python
6
star
16

strata

Multi-dimensional, topologically-driven, dependency-resolving configuration framework, built to handle the complexities of advanced projects.
Python
5
star
17

hematite

Cold, hard HTTP.
Python
4
star
18

etavta

A web tool and command line utility to make sense of VTA (http://www.vta.org/) Light Rail schedules.
Python
4
star
19

PythonDoesWhat

A repo for all the adventures on http://pythondoeswhat.blogspot.com
Python
4
star
20

PythonDoesBlog

A Python-centric static blog generator
Python
4
star
21

sedimental

The personal website of Mahmoud Hashemi. Mental sediments, sedimentary and sentimental.
CSS
3
star
22

less-css-mode

An emacs major mode for editing LESS (the better CSS)
Emacs Lisp
3
star
23

womp

womp (Wikipedia Open Metrics Platform) is a data extraction, processing, and management suite.
Python
3
star
24

euler

a few solutions here and there
Python
2
star
25

picritic

Python Package Index surveyor
Python
2
star
26

briefings

a throwaway bit of stuff for whitehouse press briefings for the internet archive govt data hackathon 2017
Python
2
star
27

diffusion

delta force
Python
2
star
28

grumblr

a little maintenance utility for tumblr blogs
Python
2
star
29

Programming-Problem-Solutions

These solutions are new and old and were written under time pressure to get a solution done quickly. Many of the questions were sourced from hacker rank
Python
2
star
30

talks

various talks, presentations, and proposals
1
star
31

socklusion

Simple, parallel, isolated, cross-platform socket interface for fire-and-forget messages.
Python
1
star
32

radio_commons

a (potentially temporary) repo for a commons radio
Python
1
star
33

misc_docs

papers just papers
1
star
34

words

those dreaded nemeses of actions
1
star
35

hatnote

Oh, y'know, some Wikipedia thoughts.
1
star
36

erosion

Exogenic linkrot for limited sharing. An example application for Clastic, Strata, and Lithoxyl.
Python
1
star
37

catamaran

Automatic categorization for MediaWiki
1
star