aisl-sdk/components/log.h

52 lines
1.3 KiB
C

/******************************************************************************
*
* Copyright (c) 2017-2019 by Löwenware Ltd
* Please, refer LICENSE file for legal information
*
******************************************************************************/
/**
* @file log.h
* @author Ilja Kartašov <ik@lowenware.com>
* @brief Log macro wrapper header-only module
*
* @see https://lowenware.com/
*/
#ifndef LOG_H_97A757CA_02E8_4D9C_BE42_29A930928F49
#define LOG_H_97A757CA_02E8_4D9C_BE42_29A930928F49
#include <cStuff/log.h>
#ifndef AX_LOG_ENABLED
#define AX_LOG_ENABLED 1
#endif
#if AX_LOG_ENABLED == 1
extern struct cstuff_log axLog;
#define AX_LOG_INIT(LEVEL) cstuff_log_init(&axLog, LEVEL)
#define AX_LOG_RELEASE() cstuff_log_release(&axLog)
#define AX_LOG_DEBUG(...) cstuff_log_printf(&axLog, CSTUFF_LOG_DEBUG, __VA_ARGS__)
#define AX_LOG_STATE(...) cstuff_log_printf(&axLog, CSTUFF_LOG_STATE, __VA_ARGS__)
#define AX_LOG_ALERT(...) cstuff_log_printf(&axLog, CSTUFF_LOG_ALERT, __VA_ARGS__)
#define AX_LOG_ERROR(...) cstuff_log_printf(&axLog, CSTUFF_LOG_ERROR, __VA_ARGS__)
#else
#define AX_LOG_DECLARE()
#define AX_LOG_INIT(TARGET)
#define AX_LOG_RELEASE()
#define AX_LOG_DEBUG(...)
#define AX_LOG_STATE(...)
#define AX_LOG_ALERT(...)
#define AX_LOG_ERROR(...)
#endif
#endif /* !LOG_H */