| iMatix home page
| << | < | > | >>
SMT Logo SMT
Version 2.81

 

smtlog_init

#include "smtdefn.h"
int
smtlog_init (void)

Synopsis

Initialises the SMT logging agent. Returns 0 if initialised okay, -1 if there was an error. The logging agent writes data to log files. Create an unnamed thread for each log file you want to manage, then send events to that thread. Supports these public methods:
CYCLE Cycle log file if it already exists.
OPEN Start a new logfile as specified by event body.
APPEND Append to an existing logfile as specified by event body.
PUT Write line to logile, prefixed by date and time.
PLAIN Use plain logfile output (no timestamp).
STAMP Put timestamp at start of each logged line.
CLOSE Close logfile and destroy thread.
Sends errors to the SMTOPER agent; does not send reply events.

Source Code - (smtlog.c)

{
    AGENT   *agent;                     /*  Handle for our agent             */
    THREAD  *thread;                    /*  Handle to console thread         */
#   include "smtlog.i"                  /*  Include dialog interpreter       */

    /*                      Method name   Event value     Priority           */
    /*  Shutdown event comes from Kernel                                     */
    method declare (agent, "SHUTDOWN",    shutdown_event, SMT_PRIORITY_MAX);

    /*  Public methods supported by this agent                               */
    method declare (agent, "CYCLE",       cycle_event,    0);
    method declare (agent, "OPEN",        open_event,     0);
    method declare (agent, "APPEND",      append_event,   0);
    method declare (agent, "PUT",         put_event,      0);
    method declare (agent, "PLAIN",       plain_event,    0);
    method declare (agent, "STAMP",       stamp_event,    0);
    method declare (agent, "CLOSE",       close_event,    0);

    /*  Ensure that operator console is running, else start it up            */
    smtoper init ();
    if ((thread = thread lookup (SMT_OPERATOR, "")) != NULL)
        console = thread-> queue-> qid;
    else
        return (-1);

    /*  Signal okay to caller that we initialised okay                       */
    return (0);
}

| << | < | > | >> iMatix Copyright © 1996-99 iMatix Corporation