poco/Foundation/include/Poco/LogFile.h

64 lines
1.2 KiB
C
Raw Normal View History

2012-04-29 20:52:25 +02:00
//
// LogFile.h
//
// Library: Foundation
// Package: Logging
// Module: LogFile
//
// Definition of the LogFile class.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
2012-04-29 20:52:25 +02:00
//
#ifndef Foundation_LogFile_INCLUDED
#define Foundation_LogFile_INCLUDED
#include "Poco/Foundation.h"
#include "Poco/Timestamp.h"
#include "Poco/FileStream.h"
2012-04-29 20:52:25 +02:00
namespace Poco {
class Foundation_API LogFile
2012-04-29 20:52:25 +02:00
/// This class is used by FileChannel to work
/// with a log file.
{
public:
LogFile(const std::string& path);
/// Creates the LogFile.
~LogFile();
/// Destroys the LogFile.
void write(const std::string& text, bool flush = true);
2012-04-29 20:52:25 +02:00
/// Writes the given text to the log file.
/// If flush is true, the text will be immediately
/// flushed to the file.
2012-04-29 20:52:25 +02:00
UInt64 size() const;
/// Returns the current size in bytes of the log file.
2017-11-09 11:15:18 +01:00
2012-04-29 20:52:25 +02:00
Timestamp creationDate() const;
/// Returns the date and time the log file was created.
2017-11-09 11:15:18 +01:00
2012-04-29 20:52:25 +02:00
const std::string& path() const;
/// Returns the path given in the constructor.
private:
std::string _path;
mutable Poco::FileOutputStream _str;
Timestamp _creationDate;
UInt64 _size;
};
2012-04-29 20:52:25 +02:00
} // namespace Poco
#endif // Foundation_LogFile_INCLUDED