Skip to main content

Prepare lines of text for easy consumption

Project description

See the documentation at

NOTE: Most of this is just planning, and doesn’t actually work yet.

This was originally designed as a tool to transform logging output into a form that I’d prefer to consume:

$ echo "Can I have a cheeseburger?" | linecook lolcats
I can haz cheezburger?

linecook doesn’t actually define way translate lines of text into lolcats, but you could easily define your own:

    'replacers': {
        'request': ['Can I', 'I can'],
        'verb': ['have', 'haz'],
        'noun': ['cheeseburger', 'cheezburger'],
    'recipes': {
        'lolcats': ['request', 'verb', 'noun'],

Recipes are just collections of transformations that translate a line of text into another line of text.

A transform is the most generic type of transformation. It’s just a function that takes a string and returns an output string.
A colorizer is simply a transform that takes a substring match and wraps it with a terminal color.
A replacer is a simple way to specify a transform that replaces a substring pattern with some output text.
A deleter is simply a replacer where the output is an empty string.
A filter matches lines of text, which are skipped.

Obviously, this is an incredibly basic (and ridiculous) example. A more useful example colorizes lines of a log file using the following configuration:

    'colorizers': {
        'warn_color': {
            'match_pattern': ' WARN ',
            'color': 'yellow',
        'error_color': {
            'match_pattern': ' ERROR ',
            'on_color': 'on_red',
    'recipes': {
        'logs': [

You can use the

$ tail -f path/to/log.txt | linecook logs

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
linecook-0.1.0.dev0-py3-none-any.whl (16.9 kB) Copy SHA256 hash SHA256 Wheel py3
linecook-0.1.0.dev0.tar.gz (12.9 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page