mirror of
https://gitee.com/jiuyilian/embedded-framework.git
synced 2025-01-06 10:16:51 -05:00
48 lines
1.3 KiB
C++
48 lines
1.3 KiB
C++
#ifndef I_LOG_H
|
|
#define I_LOG_H
|
|
// #include "VReturnCode.h"
|
|
#include <iostream>
|
|
#include <memory>
|
|
class ILog
|
|
{
|
|
public:
|
|
/**
|
|
* @brief Get the Instance object
|
|
* Return reference for runing faster. Usage : ILog::GetInstance()->Init();
|
|
* Don't use ILog like this:
|
|
* std::shared_ptr<ILog> &log = ILog::GetInstance(); or std::shared_ptr<ILog> log = ILog::GetInstance();
|
|
* log->Log("Your log.");
|
|
* @param impl Change the instance.
|
|
* @return std::shared_ptr<ILog>&
|
|
*/
|
|
static std::shared_ptr<ILog> &GetInstance(std::shared_ptr<ILog> *impl = nullptr);
|
|
ILog() = default;
|
|
virtual ~ILog() = default;
|
|
virtual bool Init() { return false; }
|
|
virtual bool UnInit() { return false; }
|
|
/**
|
|
* @brief
|
|
* If the Log module is working.
|
|
* @return true
|
|
* @return false
|
|
*/
|
|
virtual bool IsWorking() { return false; }
|
|
/**
|
|
* @brief
|
|
* Virtual log function.
|
|
* @param buff
|
|
* @return int
|
|
*/
|
|
virtual int Log(const char *buff) { return 0; }
|
|
|
|
virtual int InFo(const char *buff) { return 0; }
|
|
|
|
virtual int Warning(const char *buff) { return 0; }
|
|
|
|
virtual int Error(const char *buff) { return 0; }
|
|
|
|
virtual int Trace(const char *buff) { return 0; }
|
|
|
|
virtual int Debug(const char *buff) { return 0; }
|
|
};
|
|
#endif |