Permalink
Browse files

CHORE: Updated the readme with examples

  • Loading branch information...
1 parent 1dd8a73 commit 3b0f04dafb92681ed043576aee162a6a54a8a9fb @rudionrails committed Sep 17, 2012
Showing with 29 additions and 0 deletions.
  1. +29 −0 README.md
View
@@ -107,6 +107,35 @@ Yell['mylog']
There is no need to define outputters separately and you don't have to taint
you global namespace with Yell's subclasses.
+### You want any class to have a logger?
+
+Yell comes with a simple module: +Yell::Loggable+. Simply include this in a class and
+you are good to go.
+
+```ruby
+# Before you can use it, you will need to define a logger and
+# provide it with the `:name` of your class.
+Yell.new :stdout, :name => 'Foo'
+
+class Foo
+ include Yell::Loggable
+end
+
+# Now you can log
+Foo.new.logger.info "Hello World"
+```
+
+It even works with class inheritance:
+
+```ruby
+# Given the above example, we inherit from Foo
+class Bar < Foo
+end
+
+# The logger will fallback to the Foo superclass
+Bar.new.logger.info "Hello World"
+```
+
## Further Readings

0 comments on commit 3b0f04d

Please sign in to comment.