Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/picatz/logoris
Logoris a Ruby gem that provides a simple, unified interface to manage logging for command-line applications to the appropriate standard stream.
https://github.com/picatz/logoris
command-line logging ruby
Last synced: 3 months ago
JSON representation
Logoris a Ruby gem that provides a simple, unified interface to manage logging for command-line applications to the appropriate standard stream.
- Host: GitHub
- URL: https://github.com/picatz/logoris
- Owner: picatz
- License: mit
- Created: 2017-03-19T21:29:00.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-19T21:43:40.000Z (almost 8 years ago)
- Last Synced: 2024-10-20T05:55:41.163Z (4 months ago)
- Topics: command-line, logging, ruby
- Language: Ruby
- Size: 7.81 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
![This guy is cool.](http://i.imgur.com/0PB84Kg.png)
# Logoris
Logoris a Ruby gem that provides a simple, unified interface to manage logging for command-line applications to the appropriate standard stream.
### Why should I use this?
Do you hate having to manage your standard streams? Are your stderr events actually going to stdout, and you're like "whoa I didn't even know?" -- and you want a simple way to do this? You silly rabbit you: this is the gem for you.
#### STDOUT
Basically, when you do a `puts`, then you're going to STDOUT. This is where most of the good stuff happens.
#### STDERR
Whoa, you got some sort of gnarly error. Maybe some sort of diagnostics information that isn't really supposed to be parsed by normal input that happens for STDOUT? Well, we have STDERR for that stuff, silly.
## Installation
$ gem install logoris
## Usage
```ruby
require 'logoris'# create a new logoris instance, ya' know
logger = Logoris.new(log_file: "/var/log/some_application.log")logger.error "This will go to STDERR" # for your errors
logger.out "This will go to STDOUT" # for your normal stuff# why not check if the log exists?
logger.log_exists?(logger.log_file)
# => true
# there's almost no reason for this method
# but, there's a method to my madness
# :)
```Maybe you want to log your errors and regular output in their own special files?
```ruby
# assuming you've already created a new logoris instance, ya' know# log them errors
logger.error_file = "error.log"
logger.error "This will go a to file (error.log), and to stderr"# log them... not errors?
logger.out_file = "not_errors.log"
logger.out "This will go a to file (not_errors.log), and to stdout"# Totes proving it works via this static example.
File.readlines(logger.error_file)
# => ["This will go a to file (error.log), and to stderr\n"]
```## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).