Bot::Cobalt::Logger::Output::File - Bot::Cobalt::Logger file output
$output_obj->add( 'MyFile' => { type => 'File', ## Required: file => $path_to_log, ## Optional: # perms() defaults to 0666 and is modified by umask: perms => 0666, # mode() should be Fcntl constants suitable for sysopen() # defaults to O_WRONLY | O_APPEND | O_CREAT mode => O_WRONLY | O_APPEND | O_CREAT, }, );
See Bot::Cobalt::Logger::Output.
This is a Bot::Cobalt::Logger::Output writer for logging messages to a file.
The constructor requires a "file" specification (the path to the actual file to write). "perms" or </mode> can also be set at construction time but are optional.
The log file is kept open persistently, but closed and reopened if the file's inode has changed or the file has disappeared. This doesn't apply on Windows, which has no concept of inodes; an open-write-close cycle will be executed for each logged message on systems without useful inode details, in order to ensure messages are going to the expected file.
Attempts to lock the file for every write; if a lock cannot be obtained after half a second, falls back to warn
ing with the log message included.
Expects UTF-8.
Retrieve or set the current file path.
Retrieve or set the permissions passed to sysopen()
.
This should be an octal mode and will be modified by the current umask
.
Defaults to 0666
Retrieve or set the open mode passed to sysopen()
.
See Fcntl.
Defaults to:
O_WRONLY | O_APPEND | O_CREAT
Jon Portnoy <avenj@cobaltirc.org>