add PISystemTime::toFrequency(), add PILog
This commit is contained in:
66
libs/main/application/pilog.h
Normal file
66
libs/main/application/pilog.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/*! \file pilog.h
|
||||
* \ingroup Application
|
||||
* \~\brief
|
||||
* \~english High-level log
|
||||
* \~russian Высокоуровневый лог
|
||||
*/
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
High-level log
|
||||
Ivan Pelipenko peri4ko@yandex.ru
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PIlog_H
|
||||
#define PIlog_H
|
||||
|
||||
#include "pifile.h"
|
||||
#include "piiostream.h"
|
||||
#include "pithread.h"
|
||||
|
||||
//! \ingroup Application
|
||||
//! \~\brief
|
||||
//! \~english High-level log
|
||||
//! \~russian Высокоуровневый лог
|
||||
class PIP_EXPORT PILog: public PIThread {
|
||||
PIOBJECT_SUBCLASS(PILog, PIThread)
|
||||
|
||||
public:
|
||||
PILog();
|
||||
~PILog();
|
||||
|
||||
PIString dir() const { return log_dir; }
|
||||
void setDir(const PIString & d);
|
||||
|
||||
PISystemTime splitTime() const { return split_time; }
|
||||
void setSplitTime(PISystemTime st) { split_time = st; }
|
||||
|
||||
void enqueue(const PIString & msg);
|
||||
|
||||
private:
|
||||
void newFile();
|
||||
void run() override;
|
||||
|
||||
PIMutex log_mutex;
|
||||
PIFile log_file;
|
||||
PIIOTextStream log_ts;
|
||||
PITimeMeasurer split_tm;
|
||||
PISystemTime split_time;
|
||||
PIString log_dir;
|
||||
PIQueue<PIString> queue;
|
||||
int part_number = -1;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user