Skip to content

Commit

Permalink
Correct documention as pointed out in issue #2
Browse files Browse the repository at this point in the history
Also add a test to ensure the example code in the SYOPSIS works with the released code.
  • Loading branch information
jasonjayr committed Jul 5, 2012
1 parent e4f3c33 commit 467e2a1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/Log/Any/Adapter/FileHandle.pm
Expand Up @@ -7,8 +7,10 @@ Log::Any::Adapter::FileHandle - A basic Log::Any::Adapter to forward messages to
=head1 SYNOPSIS
use Log::Any qw($log);
use Log::Any::Adapter;
$log->set_adapter('FileHandle');
# Send all logs to Log::Any::Adapter::FileHandle
Log::Any::Adapter->set('FileHandle');
$log->info("Hello world");
Expand Down
24 changes: 24 additions & 0 deletions t/3-synopsis.t
@@ -0,0 +1,24 @@
use Test::More;
use IO::File;
use IO::String;


plan tests => 1;

my $buf = IO::String->new();
# TODO: automatically extract this from the module?
eval q{
use Log::Any qw($log);
use Log::Any::Adapter;
# Send all logs to Log::Any::Adapter::FileHandle
Log::Any::Adapter->set('FileHandle', fh=>$buf);
$log->info("Hello world");
};
die $@ if $@;

is(${$buf->string_ref},"[info] Hello world\n", "Testing example in SYOPSIS")


0 comments on commit 467e2a1

Please sign in to comment.