Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 38 lines (24 sloc) 0.669 kb
91f445a @rudionrails CHORE: Added example for the loggable module
authored
1 # encoding: utf-8
2
3 require_relative '../lib/yell'
4
5 puts <<-EOS
6
7 # You can add logging to any class by including the Yell::Loggable module.
8 #
9 # When including the module, your class will get a :logger method. Before you
10 # can use it, though, you will need to define a logger providing the :name of
11 # your class.
12
13 Yell.new :stdout, :name => 'Foo'
14
15 # Define the class
16 class Foo
17 include Yell::Loggable
18 end
19
20 foo = Foo.new
21 foo.logger.info "Hello World!"
22 #=> "2012-02-29T09:30:00+01:00 [ INFO] 65784 : Hello World!"
23
24
25 EOS
26
27 puts "=== actual example ==="
28
29 Yell.new :stdout, :name => 'Foo'
30
31 class Foo
32 include Yell::Loggable
33 end
34
35 foo = Foo.new
36 foo.logger.info "Hello World!"
37
Something went wrong with that request. Please try again.