[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    addsev(3C) manual page Table of Contents

Name

addsev - define additional severities

Synopsis


int addsev(int int_val, const char *string);

MT-Level

MT-safe

Description

The function addsev() defines additional severities for use in subsequent calls to pfmt() or lfmt(). addsev() associates an integer value int_val in the range [5-255] with a character string. It overwrites any previous string association with int_val and string.

If int_val is ORed with the flags passed to subsequent calls pfmt() or lfmt(), string will be used as severity.

Passing a NULL string removes the severity.

Add-on severities are only effective within the applications defining them.

Return Value

addsev() returns 0 in case of success, -1 otherwise.

Usage

Only the standard severities are automatically displayed per the locale in effect at runtime. An application must provide the means for displaying locale-specific versions of add-on severities.

Example


    #define Panic    5
    setlabel("APPL");
    setcat("my_appl");
    addsev(Panic, gettxt(":26", "PANIC"));
    /* ... */
    lfmt(stderr, MM_SOFT|MM_APPL|PANIC, ":12:Cannot locate database\n");

will display the message to stderr and forward to the logging service:

    APPL: PANIC: Cannot locate database

See Also

gettxt(3C) , lfmt(3C) , pfmt(3C) .


Table of Contents