Fix log enum type parameter.

This commit is contained in:
xiaojiazhu 2023-09-08 20:51:00 -07:00
parent 3c52037560
commit 3daf05fa02
5 changed files with 9 additions and 9 deletions

View File

@ -1,5 +1,5 @@
#include "Log.h"
#include "ILog.h"
#include "IHal.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
@ -8,7 +8,7 @@ namespace IHalTest
// ../out/test/bin/IHalTest --gtest_filter=IHalTest.Demo
TEST(IHalTest, Demo)
{
InitLog(LOG_EASYLOGGING, nullptr);
ILogInit(LOG_EASYLOGGING);
create_hal_module();
StatusCode code = IHalInit();
if (IsCodeOK(code))
@ -17,6 +17,6 @@ namespace IHalTest
}
IHalUnInit();
destroy_hal_module();
UnInitLog();
ILogUnInit();
}
}

View File

@ -1,7 +1,7 @@
# cmake_minimum_required(VERSION 2.8.0)
#Compile gtest for test code.
add_subdirectory(ReturnCode)
# add_subdirectory(ReturnCode)
add_subdirectory(Log)

View File

@ -11,7 +11,7 @@ namespace ILogTest
LogInfo("hello world.");
LogError("create ... failed.");
LogDebug("a = %d b = %s", 124, "apple");
IHalUnInit();
ILogUnInit();
DestroyLogModule();
}
} // namespace ILogTest

View File

@ -1,7 +1,7 @@
#include "ILog.h"
#include "ILogCpp.h"
#include <string.h>
static void ILogInitCallBack(ILog *object, const int log)
static void ILogInitCallBack(ILog *object, const enum LogInstance log)
{
return ILogCpp::GetInstance()->Init(log);
}

View File

@ -35,7 +35,7 @@ extern "C"
typedef struct i_log ILog;
typedef struct i_log
{
void (*init)(ILog *, const int);
void (*init)(ILog *, const enum LogInstance);
void (*free)(ILog *);
int (*printf)(ILog *, const char *, const int, const int, const char *, ...);
void (*un_init)(ILog *);
@ -43,11 +43,11 @@ extern "C"
ILog *GetLogIntance(void);
void NewILog(ILog **object);
void ResetLogImpl(ILog *impl);
static inline void ILogInit(const int log)
static inline void ILogInit(const enum LogInstance log)
{
return GetLogIntance()->init(GetLogIntance(), log);
}
static inline void ILolUnInit(void)
static inline void ILogUnInit(void)
{
return GetLogIntance()->un_init(GetLogIntance());
}