/*
 *               Copyright (C) 2005, BroadOn Communications Corp.
 *
 *  These coded instructions, statements, and computer programs contain
 *  unpublished  proprietary information of BroadOn Communications Corp.,
 *  and  are protected by Federal copyright law. They may not be disclosed
 *  to  third  parties or copied or duplicated in any form, in whole or in
 *  part, without the prior written consent of BroadOn Communications Corp.
 *
 */
#ifndef __IOSLOG_H__
#define __IOSLOG_H__

#define IOS_LOG_INFO     1
#define IOS_LOG_WARN     2
#define IOS_LOG_ERROR    4
#define IOS_LOG_TRACE    8

#ifndef IOS_LOG_LEVEL
#define IOS_LOG_LEVEL    0
#endif

#if IOS_LOG_LEVEL != 0
#include <ioslibc.h>
#define IOS_LOG(l, f, args...) \
    do {                                \
        if (l & IOS_LOG_LEVEL) {       \
            printf(f, ##args);          \
        }                               \
    } while(0)

#define IOS_WARN(args...) \
    IOS_LOG(IOS_LOG_WARN, "[IOS] " args)

#define IOS_ERROR(args...) \
    IOS_LOG(IOS_LOG_ERROR, "[IOS] " args)

#define IOS_ENTRY() \
    IOS_LOG(IOS_LOG_TRACE, "[IOS] Enter: %s(), %s:%d\n", \
        __FUNCTION__, __FILE__, __LINE__)

#define IOS_EXIT() \
    IOS_LOG(IOS_LOG_TRACE, "[IOS] Exit: %s(), %s:%d\n", \
        __FUNCTION__, __FILE__, __LINE__)

#else
#define IOS_LOG(l, f, ...)   (void)(0)
#define IOS_WARN(...)        (void)(0)
#define IOS_ERROR(...)       (void)(0)
#define IOS_ENTRY()          (void)(0)
#define IOS_EXIT()           (void)(0)
#endif

#endif /*__IOSLOG_H__*/
