You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

188 lines
3.5 KiB

/*
* Copyright (c) Hisilicon Technologies Co., Ltd.. 2020-2020. All rights reserved.
* Description: Logcat version of the slog function implementation
* Author: Hisilicon
* Create: 2020-10-9
*/
#include "securec.h"
#include "slog.h"
#ifdef __cplusplus
#ifndef LOG_CPP
extern "C" {
#endif
#endif // __cplusplus
static int g_is_inited = -1;
__attribute__ ((constructor)) void dlog_init();
/**
* @brief dlog_init: libslog.so initialize
* @return: void
*/
void dlog_init(void)
{
g_is_inited = 0;
}
/**
* @brief dlog_getlevel: get module loglevel
* @param [in]module_id: moudule Id eg: CCE
* @param [in/out]enableEvent: point to enableEvent to record enableEvent
* @return: module level(0: debug, 1: info, 2: warning, 3: error, 4: null output)
*/
int dlog_getlevel(int module_id, int *enable_event)
{
return 0;
}
/**
* @brief dlog_setlevel: set module loglevel and enableEvent
* @param [in]module_id: moudule id(see slog.h, eg: CCE), -1: all modules, others: invalid
* @param [in]level: log level(0: debug, 1: info, 2: warning, 3: error, 4: null output)
* @param [in]enableEvent: 1: enable; 0: disable, others:invalid
* @return: 0: SUCCEED, others: FAILED
*/
int dlog_setlevel(int module_id, int level, int enable_event)
{
int ret = 0;
return ret;
}
/**
* @brief CheckLogLevel: check log allow output or not
* @param [in]module_id: module Id
* @param [in]level: log level
* @return: TRUE/FALSE
*/
int CheckLogLevel(int module_id, int level)
{
return 0;
}
/**
* @brief DlogSetAttr: set log attr
* @param [in]logAttr: attr info, include pid, process type and device id
* @return: 0: SUCCEED, others: FAILED
*/
int DlogSetAttr(LogAttr logAttr)
{
return 0;
}
void DlogErrorInner(int module_id, const char *fmt, ...)
{
printf("DlogErrorInner stub\n");
}
void DlogWarnInner(int module_id, const char *fmt, ...)
{
printf("DlogWarnInner stub\n");
}
void DlogInfoInner(int module_id, const char *fmt, ...)
{
printf("DlogInfoInner stub\n");
}
void DlogDebugInner(int module_id, const char *fmt, ...)
{
printf("DlogDebugInner stub\n");
}
void DlogEventInner(int module_id, const char *fmt, ...)
{
printf("DlogEventInner stub\n");
}
/**
* @brief DlogInner: log interface with level
* @param [in]module_id: moudule Id eg: CCE
* @param [in]level: log level((0: debug, 1: info, 2: warning, 3: error)
* @param [in]fmt: log msg string
* @return: void
*/
void DlogInner(int module_id, int level, const char *fmt, ...)
{
printf("DlogInner stub\n");
}
/**
* @brief DlogFlush: flush log buffer to file
* @return: void
*/
void DlogFlush(void)
{
return;
}
#ifdef __cplusplus
#ifndef LOG_CPP
}
#endif // LOG_CPP
#endif // __cplusplus
#ifdef LOG_CPP
#ifdef __cplusplus
extern "C" {
#endif
int DlogGetlevelForC(int module_id, int *enableEvent)
{
return dlog_getlevel(module_id, enableEvent);
}
int DlogSetlevelForC(int module_id, int level, int enableEvent)
{
return dlog_setlevel(module_id, level, enableEvent);
}
int CheckLogLevel_for_c(int module_id, int logLevel)
{
return CheckLogLevel(module_id, logLevel);
}
int DlogSetAttrForC(LogAttr logAttr)
{
return DlogSetAttr(logAttr);
}
void DlogFlushForC(void)
{
return DlogFlush();
}
void DlogInnerForC(int module_id, int level, const char *fmt, ...)
{
}
#ifdef __cplusplus
}
#endif
#endif // LOG_CPP
// the code for stub
#if (!defined PROCESS_LOG && !defined PLOG_AUTO)
#include "plog.h"
#ifdef __cplusplus
extern "C" {
#endif
int DlogReportInitialize()
{
return 0;
}
int DlogReportFinalize()
{
return 0;
}
#ifdef __cplusplus
}
#endif
#endif