NAME

coreLogZoneInit() -- initialize an appCORE logging zone.


SYNOPSIS

include "appcore.h"

int coreLogZoneInit( coreSPEC_t* s, coreLogZone_t Zone, int Level );

DESCRIPTION

The coreLogZoneInit() function is provided to initialize an appCORE logging zone prior to starting appCORE. This is strictly a convenience function to allow different logging zones to be setup before appCORE is started. This function may be called multiple times to setup multiple log zones. The available zones are specified in the header file appcore/log_debug.h.

User defined zones are initialized via the coreAppLogZoneInit() function. appCORE provides extensive logging facilities. Refer to the section on Logging for more information.


PARAMETERS

s	
	Pointer to the specification record.
		
Zone	
	The zone we are setting the level for. Valid zones are enumerated in the
	header file appcore/log_debug.h.

Level
	The level we are setting. The enumeration coreDbgLogLevel_t defines the 
	enumerated levels. However, valid levels are 0 through 255.

The coreLogZone_t enumeration defines the internal appCORE log zones. Internal zones start at CORE_LOG_ZONE_START. The default value for this is 100. Available user log zones are from 0 up to CORE_LOG_ZONE_START. The following enumeration defines the zones and describes their function.

typedef enum    _core_log_zone_
{
    //--------------------------------------------------------------------------
    //
    // Zones 0 -> (CORE_ZONE_START-1) are user zones.
    //
    //--------------------------------------------------------------------------

    LZ_CORE_START           = CORE_LOG_ZONE_START,

    // SDK Interface

    LZ_SDK_CORE,            // 101 - core
    LZ_SDK_APP,             // 102 - application
    LZ_SDK_MEM,             // 103 - memory
    LZ_SDK_CFG,             // 104 - config
    LZ_SDK_MAP,             // 105 - maps
    LZ_SDK_IO,              // 106 - io
    LZ_SDK_THR,             // 107 - threads
    LZ_SDK_MCORE,           // 108 - mcore threads
    LZ_SDK_DISP,            // 109 - dispatch
    LZ_SDK_MSG,             // 110 - messaging
    LZ_SDK_REQ,             // 111 - req/resp
    LZ_SDK_CMD,             // 112 - cmds
    LZ_SDK_CMDSES,          // 113 - cmd sessions
    LZ_SDK_TMR,             // 114 - timers
    LZ_SDK_NET,             // 115 - networking
    LZ_SDK_NETSVR,          // 116 - network server
    LZ_SDK_NETCHAN,         // 117 - network channel
    LZ_SDK_UTIL,            // 118 - utility 

    // Threads

    LZ_THR_APP,             // 119 - App
    LZ_THR_SIG,             // 120 - Signal
    LZ_THR_LOG,             // 121 - Logger
    LZ_THR_TMR,             // 122 - Timer
    LZ_THR_SRV,             // 123 - Server
    LZ_THR_IO,              // 124 - IO

    // Internal Zones

    LZ_INT_LOG,             // 125 - logging
    LZ_INT_DLL,             // 126 - double linked list
    LZ_INT_CFG,             // 127 - config
    LZ_INT_LOCKFILE,        // 128 - lock file
    LZ_INT_IO,              // 129 - io
    LZ_INT_NET,             // 130 - networking
    LZ_INT_MSG,             // 131 - msg
    LZ_INT_MSGTRC,          // 132 - msg trace
    LZ_INT_MSGCHAN,         // 133 - msg channel
    LZ_INT_CONSOLE,         // 134 - console
    LZ_INT_CMD,             // 135 - command
    LZ_INT_CMDSES,          // 136 - command sessions
    LZ_INT_TMR,             // 137 - timers

    // Limit

    LZ_CORE_MAX
}
coreLogZone_t;

The coreDbgLogLevel_t enumeration defines the log levels available. The higher the level, the more debug output is generated. For example, LL_FUNC (10) is for function level trace, while LL_PKT (6) is for packet level trace. Protocol level tracing, LL_PROTO (5) is one lower then packet tracing. This allows for protocol level tracing without full packet details. The default level is normally LL_INFO (3) as this provides for errors, warnings, and informational data.

typedef enum    _core_dbglog_level_
{
    LL_NONE         = 0,                    // off
    LL_ERROR        = 1,                    // errors
    LL_WARN         = 2,                    // warnings
    LL_INFO         = 3,                    // information
    LL_INTF         = 4,                    // interface
    LL_PKT          = 5,                    // packet
    LL_PROTO        = 6,                    // protocol
    LL_TIMER        = 7,                    // timers
    LL_SPARE8       = 8,                    // spare
    LL_SPARE9       = 9,                    // spare
    LL_FUNC         = 10,                   // function entry
    LL_LOCK         = 11,                   // locks
    LL_PRIV         = 12,                   // internal
    LL_SPARE13      = 13,                   // spare
    LL_SPARE14      = 14,                   // spare
    LL_SPARE15      = 15,                   // spare
    LL_SPARE16      = 16,                   // spare
    LL_SPARE17      = 17,                   // spare
    LL_SPARE18      = 18,                   // spare
    LL_SPARE19      = 19,                   // spare
    LL_END          = 20,

    // Open for use

    LL_MAX          = 255
}
coreDbgLogLevel_t;


RETURN VALUE

If successful, coreLogZoneInit() returns 0. If an error occurs, it returns a value of -1 and sets errno to one of the following values:

errno ValueCondition
EINVALPointer to coreSPEC_t is NULL, or invalid zone or level.

MULTITHREAD SAFETY LEVEL

MT-safe.


SEE ALSO

Functions:
coreInit() coreDeinit() coreAppLogZoneInit()