init
This commit is contained in:
44
unitree_SDK/include/unitree/common/log/log_keeper.hpp
Normal file
44
unitree_SDK/include/unitree/common/log/log_keeper.hpp
Normal file
@@ -0,0 +1,44 @@
|
||||
#ifndef __UT_LOG_FILE_KEEPER_H__
|
||||
#define __UT_LOG_FILE_KEEPER_H__
|
||||
|
||||
#include <unitree/common/log/log_policy.hpp>
|
||||
|
||||
namespace unitree
|
||||
{
|
||||
namespace common
|
||||
{
|
||||
class LogKeeper
|
||||
{
|
||||
public:
|
||||
LogKeeper(LogStorePolicyPtr storePolicyPtr);
|
||||
~LogKeeper();
|
||||
|
||||
LogStorePolicyPtr GetStorePolicy() const;
|
||||
|
||||
bool Append(const std::string& s, bool rotate);
|
||||
|
||||
private:
|
||||
void Rotate();
|
||||
|
||||
void AppendFile(const std::string& s);
|
||||
void OpenFile();
|
||||
void CloseFile();
|
||||
|
||||
void CheckFileSize();
|
||||
|
||||
std::string MakeRegexExpress();
|
||||
|
||||
private:
|
||||
volatile int64_t mFileSize;
|
||||
std::string mFileName;
|
||||
std::string mDirectory;
|
||||
FilePtr mFilePtr;
|
||||
LogStorePolicyPtr mStorePolicyPtr;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<LogKeeper> LogKeeperPtr;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif//__UT_LOG_FILE_KEEPER_H__
|
Reference in New Issue
Block a user