https://github.com/iepathos/logit
Logit is an easy to use logging wrapper for command applications.
https://github.com/iepathos/logit
Last synced: about 6 hours ago
JSON representation
Logit is an easy to use logging wrapper for command applications.
- Host: GitHub
- URL: https://github.com/iepathos/logit
- Owner: iepathos
- License: mit
- Created: 2016-01-16T22:34:07.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-01-17T06:22:24.000Z (over 10 years ago)
- Last Synced: 2025-10-09T20:02:59.843Z (10 months ago)
- Language: Python
- Size: 12.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
Logit
-------
Logit is an easy to use logging wrapper for command line applications. Logit executes the command passed to it and writes a timestamp, the command executed and its output to a log file. Logit is useful when you require dead simple timestamp logging added over the output from a command line application. Built using Python 3.4.3, should be compatible with earlier Python 3 releases, definitely compatible wth Python 3.5.1 as well.
## Execute Logit
````shell
python3 logit.py "echo test" -l /custom/log/path.log
cat /custom/log/path.log
````
The default log path ~/logit.log is used if logit is called without any argument.
````shell
python3 logit.py "curl -ks https://bitpay.com/api/rates | python -m json.tool"
````
## Comands
+ Specify log filename "--log" or "-l"
+ Silence logit feedback output "--silent" or "-s"
## Example
````shell
$ ./logit.py "echo test" -l test.log
Executing 'echo test'
Saving output to log test.log
$ cat test.log
2016-01-16 22:35:27.375387 - Executing 'echo test'
test
````
## Crontab
````shell
0 6 * * * python3 logit.py "brew cask update" -l brewupdates.log
````
## Add symlink to bin for easier use
````shell
# os x
ln -s path/to/logit.py /usr/local/bin/logit
logit 'brew cask update'
# debian-based
sudo logit 'apt-get update'
````
Logit is Open Sourced under an MIT License.