Skip to content

Commit

Permalink
add slog to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
wchristian committed Sep 21, 2017
1 parent 139c586 commit 1b76d0b
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions lib/Log/Contextual.pm
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ __END__
log_trace { 'foo entered' };
my ($foo, $bar) = Dlog_trace { "params for foo: $_" } @args;
# ...
log_trace { 'foo left' };
slog_trace 'foo left';
};
}
Expand Down Expand Up @@ -326,7 +326,7 @@ Major benefits:
=item * Efficient
The logging functions take blocks, so if a log level is disabled, the
The default logging functions take blocks, so if a log level is disabled, the
block will not run:
# the following won't run if debug is off
Expand Down Expand Up @@ -591,6 +591,14 @@ B<Note:> C<log_fatal> does not call C<die> for you, see L</EXCEPTIONS AND ERROR
=back
=head2 slog_$level
Mostly the same as L</log_$level>, but expects a string as first argument,
not a block. Arguments are passed through just the same, but since it's just a
string, interpolation of arguments into it must be done manually.
my @friends = slog_trace 'friends list being generated.', generate_friend_list();
=head2 logS_$level
Import Tag: C<:log>
Expand All @@ -607,6 +615,14 @@ same:
See also: L</DlogS_$level>.
=head2 slogS_$level
Mostly the same as L</logS_$level>, but expects a string as first argument,
not a block. Arguments are passed through just the same, but since it's just a
string, interpolation of arguments into it must be done manually.
my $friend = slogS_trace 'I only have one friend.', friend();
=head2 Dlog_$level
Import Tag: C<:dlog>
Expand Down Expand Up @@ -649,6 +665,15 @@ B<Note:> C<Dlog_fatal> does not call C<die> for you, see L</EXCEPTIONS AND ERROR
=back
=head2 Dslog_$level
Mostly the same as L</Dlog_$level>, but expects a string as first argument,
not a block. Arguments are passed through just the same, but since it's just a
string, no interpolation point can be used, instead the Dumper output is
appended.
my @nicks = Dslog_debug "names: ", map $_->value, $frew->names->all;
=head2 DlogS_$level
Import Tag: C<:dlog>
Expand All @@ -662,6 +687,16 @@ slurping up (and also setting C<wantarray>) all the C<@args>
my $pals_rs = DlogS_debug { "pals resultset: $_" }
$schema->resultset('Pals')->search({ perlers => 1 });
=head2 DslogS_$level
Mostly the same as L</DlogS_$level>, but expects a string as first argument,
not a block. Arguments are passed through just the same, but since it's just a
string, no interpolation point can be used, instead the Dumper output is
appended.
my $pals_rs = DslogS_debug "pals resultset: ",
$schema->resultset('Pals')->search({ perlers => 1 });
=head1 LOGGER CODEREF
Anywhere a logger object can be passed, a coderef is accepted. This is so
Expand Down

0 comments on commit 1b76d0b

Please sign in to comment.