Giter Site home page Giter Site logo

hog's Introduction

hog

Hog helps you specify the files you want to open when looking through your Scribe logs.

PyPI version build status codecov Checked with mypy Code style: black

Install

pip3 install --upgrade scribehog

Usage

hog [options] logcategory [interval]

Options:
-h, --help Print usage information.
-v, --verbose Verbose logging.
-y, --verify Require user confirmation before printing the selected logs.

logcategory a hyphen-separated list of words or word prefixes to test against the hyphen- or underscore-separated logcategory names.
For example: if your logcategory is called alpha_bravo_charlie, you can match it with alpha-bravo-charlie, or just al-brav-c, maybe even a-b-c, as long as it's unambigious given the list of all logcategories.
Note that the order of the words does not matter, ie. al-br-ch and ch-br-al are the same.

interval a reference to the file or files you want to read. The default value is -1, meaning the most recent file. You can either use negative numbers as relative references like this, or specify a date and time in the format of hh, dd-hh, mm-dd-hh, or yyyy-mm-dd-hh. For example, you can pass -3 for the third most recent logfile, or 10-09 for the logfile on the 10th at 9:00 AM (note the leading 0 in the hour).

Ranges can also be specified by using a colon, eg. -3:-2 or 10-15:10-18.
Relative and absolute references can be freely mixed, eg. -10:12-31-20.
When omitting a reference from either side of the colon, the end of the list is assumed, just like in Python list slicing, eg. -5:.

You don't have to know if the specified files are gzip-compressed or not, hog takes care of that for you.
The contents are uniformly printed to stdout, so you can pipe the output into grep, less or whatever you need to use.

Development

Make sure you have Python (>=3.5) installed.
Clone the repository, then call make develop.

hog - Photo by Fabian Blank on Unsplash

hog's People

Contributors

endreymarcell avatar

Watchers

James Cloos avatar

hog's Issues

Unable to distinguis foo_bar from bar_foo

The order of keywords is not important, therefore foo-bar will match the foo_bar and bar_foo categories the same, and there's no way to differentiate between them. Let's update the logic so that when order is to only differentiating feature, then it does make a difference.

Extend date specifiers with wildcards

Currently there's no easy way to get all the logfiles from a specific day (if the day is specified, the hour is also required). This is a frequent use-case, hog should be extended to support this, eg. with some kind of wildcard syntax (11-27-*).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.