README.md in console-1.1.1 vs README.md in console-1.2.0

- old
+ new

@@ -89,20 +89,18 @@ end Console.logger.info("My Console", MyConsole.new) ``` -#### Error Events +#### Failure Events -`Console::Error` represents an error and will log the message and backtrace recursively. +`Console::Event::Failure` represents an exception and will log the message and backtrace recursively. -#### Shell Events +#### Spawn Events -`Console::Shell` represents the execution of a shell command, and will log the environment, arguments and options used to execute it. +`Console::Event::Spawn` represents the execution of a command, and will log the environment, arguments and options used to execute it. -### Multiple Loggers - ### Custom Log Levels `Console::Filter` implements support for multiple log levels. ```ruby @@ -116,21 +114,40 @@ logger.broken("It's so janky.") ``` ### Multiple Outputs +Use `Console::Split` to log to multiple destinations. + ```ruby require 'console/terminal' require 'console/serialized/logger' require 'console/logger' require 'console/split' terminal = Console::Terminal::Logger.new -file = Console::Serialized::Logger.new(File.open("/tmp/log.json", "w")) +file = Console::Serialized::Logger.new(File.open("log.json", "a")) logger = Console::Logger.new(Console::Split[terminal, file]) logger.info "I can go everywhere!" +``` + +### Custom Logger Output + +`Console::Logger` provides a default interface which is a drop in replacemnet for `Logger` and other similar implementations. The only method required for output is `#call(*arguments, **options, &block)`. + +```ruby +require 'console/logger' + +output = proc do |*arguments, **options, &block| + puts "arguments: #{arguments.inspect} options: #{options.inspect} block: #{block.call}" +end + +logger = Console::Logger.new(output) + +logger.info("Hello World!", meta: "data") {"block"} +# => arguments: ["Hello World!"] options: {:severity=>:info, :meta=>"data"} block: block ``` ## Contributing 1. Fork it