Next: , Previous: mu dbm, Up: mu


3.17.12 mu logger

The mu logger tool logs information using Mailutils log facility.

Syntax:

     mu logger [options] [message]

The message argument, if supplied, gives the text to log. If not supplied, the utility reads lines of text from standard input or a file (if the --file option is given) and sends them to log:

     # Send text to log
     $ mu logger I am here
     # Log each line from file.txt
     $ mu logger --file file.txt
     # Read stdin and log it:
     $ mu logger

The default logging channel is bound to standard error. To bind it to syslog, use the --syslog command line option. In that case mu uses facility ‘user’ and priority ‘err’. You can change this by using the --priority (-p) option. Its argument is either a syslog facility name or facility and severity names separated by a dot. For example, the following invocation will use facility ‘auth’, severity ‘info’:

     mu logger --priority auth.info

The syslog tag can be set using the --tag (-t) option:

     mu logger --tag myprog

The default tag is ‘mu-logger’.

The --severity (-s) option sets the Mailutils severity level. Its argument can be any of the following: ‘debug’, ‘info’, ‘notice’, ‘warning’, ‘error’, ‘crit’, ‘alert’, ‘emerg’.

Finally, the --locus (-l) option binds log messages to a location in a file. Its argument has the following syntax:

     file:line[:col]

where file is the file name, line is the line number and optional col is the column number in that file.

For example, the following invocation:

     mu logger --locus mailutils.rc:34 Suspicious statement

will send the following to the log:

     mu-logger: mailutils.rc:34: Suspicious statement