File: README.md

package info (click to toggle)
ruby-logger-application 0.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 184 kB
  • ctags: 31
  • sloc: ruby: 284; makefile: 2
file content (56 lines) | stat: -rw-r--r-- 1,305 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Logger::Application

[![Gem Version](https://badge.fury.io/rb/logger-application.png)](http://badge.fury.io/rb/logger-application)
[![Build Status](https://secure.travis-ci.org/hsbt/logger-application.png)](http://travis-ci.org/hsbt/logger-application)

## Description

Add logging support to your application.

## Installation

Add this line to your application's Gemfile:

    gem 'logger-application'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install logger-application

## Usage

 1. Define your application class as a sub-class of this class.
 2. Override the +run+ method in your class to do many things.
 3. Instantiate it and invoke #start.

## Example

```ruby
class FooApp < Logger::Application
  def initialize(foo_app, application_specific, arguments)
    super('FooApp') # Name of the application.
  end

  def run
    ...
    log(WARN, 'warning', 'my_method1')
    ...
    @log.error('my_method2') { 'Error!' }
    ...
  end
end

status = FooApp.new(....).start
```

## Contributing

1. Fork it ( https://github.com/hsbt/logger-application/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request