Skip to content

Commit

Permalink
Document hooks for logging engine
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason A. Crome committed Jan 2, 2024
1 parent 8eb7e83 commit 0e83b4a
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions lib/Dancer2/Manual.pod
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,35 @@ for details on the following hooks:

=back

=head2 Logging

Logging hooks do not allow you to alter log message content, but they do
give you a place to perform extra actions. For example, if you want to send
an email for error messages, but you don't want to use a heavier logger
such as L<Log::Any> or L<Log::Log4perl>:

hook 'engine.logger.after' => sub {
my ( $logger, $level, $message ) = @_;

if( $level eq 'error' ) {
# Send an email with the message content
}
};

There are two hooks available for logging:

=over 4

=item * engine.logger.before

This hook is called before a log message is produced.

=item * engine.logger.after

This hook is called after a log message is produced.

=back

=head2 Serializers

=over 4
Expand Down

0 comments on commit 0e83b4a

Please sign in to comment.