Help language development. Donate to The Perl Foundation
A simple implementation of Log.
An array of hashes. Each has must have a handle key, with an IO::Handle to print messages to. A level key with an integer to signify a Log::Level is also required.
A supplier to emit messages to.
When enabled, include hostname in the log message. This can be useful when running the application redundantly in a cluster with centralized logging.
multi method emergency( Str:D $message ) returns Mu
Send an emergency message.
The message to print.
multi method emergency( Str:D $format, *@args ) returns Mu
Send a formatted emergency message.
A printf-style format string.
Arguments to substitute into the format string placeholders.
multi method alert( Str:D $message ) returns Mu
Send an alert message.
The message to print.
multi method alert( Str:D $format, *@args ) returns Mu
Send a formatted alert message.
A printf-style format string.
Arguments to substitute into the format string placeholders.
multi method critical( Str:D $message ) returns Mu
Send a critical message.
The message to print.
multi method critical( Str:D $format, *@args ) returns Mu
Send a formatted critical message.
A printf-style format string.
Arguments to substitute into the format string placeholders.
multi method error( Str:D $message ) returns Mu
Send an error message.
The message to print.
multi method error( Str:D $format, *@args ) returns Mu
Send a formatted error message.
A printf-style format string.
Arguments to substitute into the format string placeholders.
multi method warning( Str:D $message ) returns Mu
Send a warning message.
The message to print.
multi method warning( Str:D $format, *@args ) returns Mu
Send a formatted warning message.
A printf-style format string.
Arguments to substitute into the format string placeholders.
multi method notice( Str:D $message ) returns Mu
Send a notice message. This is the "normal" level to publish log entries on.
The message to print.
multi method notice( Str:D $format, *@args ) returns Mu
Send a formatted notice message. This is the "normal" level to publish log entries on.
A printf-style format string.
Arguments to substitute into the format string placeholders.
multi method info( Str:D $message ) returns Mu
Send an informational message.
The message to print.
multi method info( Str:D $format, *@args ) returns Mu
Send a formatted informational message.
The printf-style format string.
Arguments to substitute into the format string placeholders.
multi method debug( Str:D $message ) returns Mu
Send a debug message.
The message to print.
multi method debug( Str:D $format, *@args ) returns Mu
Send a formatted debug message.
A printf-style format string.
Arguments to substitute into the format string placeholders.
multi method add-output( IO::Handle:D $handle, $level where { ... }, Callable :$filter ) returns Mu
Add an output to the logger.
The IO::Handle to write log messages to.
The log level for this particular stream.
A filter function to apply to any messages sent to the output.
method callee( Int:D $depth = 3 ) returns Str
Convenience method to get the callee name. This is the package name if one exists, or the source file name.
The depth of which to get the callframe.
method message( Str:D $level, Str:D $message ) returns Str
Convenience method for formatting the message as desired.
A human readable identifier for the level.
The original message to be logged.
Log::Simple
0.1.1
Patrick Spek [email protected]
Copyright © 2020
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/.