/*
 * Copyright (C) 2019 SAMSUNG S.LSI
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef __ESE_LOG__H
#define __ESE_LOG__H

/**
 * @file ese_log.h
 * @brief Log macros.
 */

/**
 * @ingroup common
 * @defgroup ese_log eSE_Log
 * @brief Log macros.
 *
 * This header file provides macros for logging eSE APIs.
 * @{
 */

#ifdef ESE_ANDROID_BUILD
#include <android/log.h>

/**
 * @brief Log macro to debug.
 */
#define ESELOG_D(...) {__android_log_print(ANDROID_LOG_DEBUG, "GRDM:"LOG_TAG, __VA_ARGS__);}
/**
 * @brief Log macro to inform.
 */
#define ESELOG_I(...) {__android_log_print(ANDROID_LOG_INFO, "GRDM:"LOG_TAG, __VA_ARGS__);}
/**
 * @brief Log macro for warning.
 */
#define ESELOG_W(...) {__android_log_print(ANDROID_LOG_WARNING, "GRDM:"LOG_TAG, __VA_ARGS__);}
/**
 * @brief Log macro for error.
 */
#define ESELOG_E(...) {__android_log_print(ANDROID_LOG_ERROR, "GRDM:"LOG_TAG, __VA_ARGS__);}
#else
#ifndef ESE_U_BOOT_BUILD
#include <stdio.h>
#endif

#include "tz_debug.h"
/**
 * @brief Log macro to debug.
 */
#define ESELOG_D LOGD
/**
 * @brief Log macro to inform.
 */
#define ESELOG_I LOGI
/**
 * @brief Log macro for warning.
 */
#define ESELOG_W LOGW
/**
 * @brief Log macro for error.
 */
#define ESELOG_E LOGE
#endif
/**
 * @}
 */
#endif
