marc/epilog

Epilog is a CLI log viewer with style

1.0.1 2015-05-14 03:36 UTC

This package is auto-updated.

Last update: 2024-10-18 06:52:16 UTC


README

Epilog

Build Status Coverage Status Scrutinizer Quality Score Latest Stable Version Total Downloads License SensioLabsInsight

The lightweight, themeable and interactive PSR-3 log viewer. Monitor monologs with style:

asciinema

Install

As a composer project dependency:

{
    "require": {
        "marc/epilog": "~1.0"
    }
}

As a packed phar:

wget https://github.com/marcioAlmada/epilog/raw/master/bin/epilog && chmod +x epilog
mv epilog /usr/local/bin/ # or somewhere in your $PATH

As a composer global package:

composer global require marc/epilog:~1.0

Or build the phar yourself:

# install box2 -> https://github.com/box-project/box2
git clone https://github.com/marcioAlmada/epilog.git
cd epilog
composer install
make # phar will available at bin/ folder
sudo make install # will put epilog at /usr/local/bin/ folder

Quick test

Run epilog pretend command and tail a fake log stream. Check if output looks good:

epilog pretend

Usage

Basic usage is:

epilog watch /path/to/monolog/file.log [<args>]...

While epilog is monitoring the log file (or a fake stream), hit [return] to see a nice interactive menu:

$ [ ⏎ ]

Woot! Epilog here. Please type a theme number, a valid regexp or a valid flag:

[#] load another theme:

    1:chaplin       2:forest
    3:scrapbook     4:punchcard
    5:sunset        6:sunrise
    7:traffic       8:usa

[ r ] load random theme from list above.
[ i ] toggle invert theme.
[ c ] clear screen.
[ - ] reset regexp filter.
[ q ] quit.

Framework Integration

Epilog can use log finders to look for logs inside app directories according to framework conventions so you don't need to aim at your latest log files mannualy. Ex:

$ epilog watch ~/www/my-project --app laravel
# instead of long and boring
$ epilog watch ~/www/my-project/app/storage/logs/log-cli-server-2015-01-11.txt

PRs implementing log finders to support your framework of choice are highly encouraged :octocat:

Themes

Epilog themes are very simple yml files with hooks where you can put ANSI color escape sequences and literal text. The hooks will decorate each log line, nyancatyze your terminal and sometimes puke rainbows. Here is a theme example:

name: Punched Card
author: Márcio Almada
theme:
    extends: default
    # the log line template
    # template tags are: {date}, {level}, {logger}, {message}, {context}, {extra}
    template: "{level} {date} {message} [{logger}] [{context}] [{extra}]"
    # literal string that will be prepended to entire line
    prepend: ""
    # literal string that will be appended to entire line
    append: "\e[0m\n"
    # level section
    level:
        padding: 10
        DEBUG:
            prepend: "\e[2m"
        INFO:
            prepend: "\e[2m"
        NOTICE:
            prepend: "\e[2m"
        WARNING:
            prepend: "\e[2m"
        ERROR:
            prepend: "\e[1m"
        CRITICAL:
            prepend: "\e[1m"
        ALERT:
            prepend: "\e[1m"
        EMERGENCY:
            prepend: "\e[1m"
        DEFAULT:
            prepend: " -------- \e[1m"

Which will make log lines look like the following, when interpreted:

punchcard theme

Roadmap

  • Basic functionalities
  • Add --app option to allow easy framework integration. Ex: epilog watch /my/project --app laravel
  • Add listen command to aggregate log entries through a REST API. Ex: epilog listen --port 8888
  • Add server command to view logs in a browser instead of terminal epilog server <file> --port 8888
  • Add better unicode support, more themes etc
  • Bother with windows ... anyone?
  • Other cool things, probably
  • Release stable version

Contributions

Found a bug? Have an improvement? Take a look at the issues.

Guide

  1. Fork marc/epilog
  2. Clone forked repository
  3. Install composer dependencies $ composer install
  4. Run unit tests $ phpunit
  5. Modify code: correct bug, implement features
  6. Back to step 4

Copyright

Copyright (c) 2014-2015 Márcio Almada. Distributed under the terms of an MIT-style license. See LICENSE for details.