.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Linux::Systemd::Journal::Write 3pm" .TH Linux::Systemd::Journal::Write 3pm 2024-03-07 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Linux::Systemd::Journal::Write \- XS wrapper around sd\-journal .SH VERSION .IX Header "VERSION" version 1.201600 .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use Linux::Systemd::Journal::Write; \& \& my $jnl = Linux::Systemd::Journal::Write\->new; \& \& # basic log messages \& $jnl\->print(\*(Aqflarg\*(Aq); # with default log level \& $jnl\->print(\*(AqHello world\*(Aq, 4); # WARN level \& \& # add abitrary data to the log entry \& my %hash = (DAY_ONE => \*(AqMonday\*(Aq, DAY_TWO => \*(AqTuesday\*(Aq, DAY_THREE => \*(AqWednesday\*(Aq); \& $jnl\->send(\*(AqHere is a message\*(Aq, \e%hash); # add abitrary data to the log entry \& \& # will log "Failed to open file: No such file or directory" and ERRNO=2 \& open my $fh, \*(Aq<\*(Aq, \*(Aqnosuchfile\*(Aq \& or $jnl\->perror(\*(AqFailed to open file\*(Aq); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" .SS "Log Levels" .IX Subsection "Log Levels" The log levels use by \f(CW\*(C`journald\*(C'\fR and by "priority" are the same as those use by \f(CW\*(C`syslog\*(C'\fR, so instead of using numeric priorities you can .PP .Vb 1 \& use Sys::Syslog \*(Aq:macros\*(Aq; .Ve .PP giving you access to the \f(CW\*(C`LOG_*\*(C'\fR "level constants" .SH ATTRIBUTES .IX Header "ATTRIBUTES" .ie n .SS """app_id""" .el .SS \f(CWapp_id\fP .IX Subsection "app_id" Will be used to set \f(CW\*(C`SYSLOG_IDENTIFIER\*(C'\fR. Defaults to \f(CWbasename($0)\fR; .ie n .SS """priority""" .el .SS \f(CWpriority\fP .IX Subsection "priority" Default log priority. See "Log Levels" .ie n .SS """caller_details""" .el .SS \f(CWcaller_details\fP .IX Subsection "caller_details" Boolean controlling whether to log the \f(CW\*(C`CODE_FILE\*(C'\fR, \f(CW\*(C`CODE_LINE\*(C'\fR, and \&\f(CW\*(C`CODE_FUNC\*(C'\fR of the caller. .PP Optional. Defaults to \f(CW\*(C`true\*(C'\fR; .PP See also \fBsystemd.journal\-fields\fR\|(7) .ie n .SS """caller_level""" .el .SS \f(CWcaller_level\fP .IX Subsection "caller_level" If this module is not being used directly, but through some proxy module for instance, \f(CW\*(C`caller_level\*(C'\fR is used to determine the number of frames to look back through. .PP Optional. Defaults to \f(CW0\fR; .SH METHODS .IX Header "METHODS" .ie n .SS """print($msg, $pri?)""" .el .SS "\f(CWprint($msg, $pri?)\fP" .IX Subsection "print($msg, $pri?)" \&\f(CW$msg\fR should be either a string. \f(CW$pri\fR is optional, and defaults to \f(CW$self\fR\->priority .ie n .SS """send($msg_or_data, $data?)""" .el .SS "\f(CWsend($msg_or_data, $data?)\fP" .IX Subsection "send($msg_or_data, $data?)" If there is one arg, it may be a simple string to log. Or, it could be a hashref or an arrayref. In this case, one of the keys sent MUST be 'message'. .PP If there are two args, the first must be the string to use as a message, the second a hashref or arrayref. In this case, a key called message should not be set. .PP Finally, \f(CW\*(C`send\*(C'\fR can also be called with an array of key => values, one of which must be message. .PP Keys will be uppercased. .ie n .SS perror($msg) .el .SS \f(CWperror($msg)\fP .IX Subsection "perror($msg)" Logs the string of the current set \f(CW\*(C`errno\*(C'\fR, prefixed with \f(CW$msg\fR. .SH "SEE ALSO" .IX Header "SEE ALSO" .IP \(bu 4 Log::Journald .Sp At some point between me writing this module and getting around to releasing it, another module was released to write the journal. .IP \(bu 4 systemd .Sp The main \f(CW\*(C`systemd\*(C'\fR page. .IP \(bu 4 \&\fBsd\-journal\fR\|(3) .Sp Man page of the C API .SH AUTHOR .IX Header "AUTHOR" Ioan Rogers .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is Copyright (c) 2020 by Ioan Rogers. .PP This is free software, licensed under: .PP .Vb 1 \& The GNU Lesser General Public License, Version 2.1, February 1999 .Ve