en fr

Sysquake Pro – Table of Contents

Sysquake – Table of Contents

Sysquake for LaTeX – Table of Contents

System Log Function

System log function enables to log messages to the system-wide logging facility. It is supported on unix systems, such as macOS and Linux.

Function

syslog

File descriptor of syslog.

Syntax

fd = syslog
fd = syslog(priority)

Description

syslog gives the file descriptor corresponding to syslog. It can be used with output functions like fprintf. Each output command causes a message to be logged with priority 'info'. No linefeed should be output. Empty messages and messages containing only line feeds and carriage returns are not logged. Note that every low-level output function produces a separate log entry; high-level functions like dumpvar, for instance, can produce a larger number of lines than expected.

syslog(priority) gives the file descriptor corresponding to messages to syslog with the specified priority. The input argument is one of the following strings: 'emerg', 'alert', 'crit', 'err', 'warning', 'notice', 'info', or 'debug'; case is ignored.

Examples

Simple information message:

fprintf(syslog, 'pi = %g', pi);

Debugging message:

fprintf(syslog('debug'), 'nargin = %d', nargin);

Redirection of standard error (all error messages and warnings are copied to syslog):

redirect(2, syslog, true);

To get the log, please see the man page of syslog or syslogd. On macOS, you can use the Console application.

See also

fprintf, redirect