/*
 * Functions for logging and catching errors.
 *
 * @copyright 2008, Research In Motion Ltd.
 *
 * @version $Id: //depot/rel/dsp/ecall/2/c/testlab/error.h#1 $
 */

#ifndef __ERROR_H__
#define __ERROR_H__

#include <stdio.h>

/*
 * Initialize logging to file handle fp. If fp is NULL, logging is disabled.
 */
void LogInit(FILE *fp);

/* 
 * Log useful information. 
 */
void LogInfo(const char *format, ...);

/* 
 * Log error information. 
 */
void LogError(const char *format, ...);

/* 
 * Unconditionally end the current process, logging an error message.
 */
void Abort(const char *format, ...);

/* 
 * End the current process, logging msg, if condition is FALSE.
 */
static __inline void Assert(BOOL condition, const char *msg)
{
    if(!condition) {
        Abort(msg);
    }
}

#endif
