#ifndef __Log_H
#define __Log_H

#include <stdio.h>
#include <stdarg.h>
#include "kernel.h"

#ifdef __cplusplus
extern "C" {
#endif

#ifdef __CC_NORCROFT
#pragma -v1 // hint to the compiler to check f/s/printf format
#endif
void Log(const char* pformat, ...);
#ifdef __CC_NORCROFT
#pragma -v0 // return to default
#endif
void VLog(const char* pformat, va_list arg);
void LogBinary(const void* pdata, int len);
void Log_Enter(const char* proc);
void Log_Exit(const _kernel_oserror*);

FILE* Log_GetFile(void);

#ifdef TRACE
#define ENTER(x) Log_Enter(x)
#define RETURN(x) {Log_Exit(0); return x;}
#define RETURN_ERROR(x) {Log_Exit(x); return x;}
#else
#define ENTER(x)
#define RETURN(x) return x;
#define RETURN_ERROR(x) return x;
#endif

#define Log_Logging 0x01
#define Log_Trace   0x02
#define Log_SysLog  0x04

void SetLoggingOptions(int opt);

#ifdef __cplusplus
}
#endif

#endif
