| 1 | // |
| 2 | // LogFile_STD.h |
| 3 | // |
| 4 | // Library: Foundation |
| 5 | // Package: Logging |
| 6 | // Module: LogFile |
| 7 | // |
| 8 | // Definition of the LogFileImpl class using iostreams. |
| 9 | // |
| 10 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. |
| 11 | // and Contributors. |
| 12 | // |
| 13 | // SPDX-License-Identifier: BSL-1.0 |
| 14 | // |
| 15 | |
| 16 | |
| 17 | #ifndef Foundation_LogFile_STD_INCLUDED |
| 18 | #define Foundation_LogFile_STD_INCLUDED |
| 19 | |
| 20 | |
| 21 | #include "Poco/Foundation.h" |
| 22 | #include "Poco/Timestamp.h" |
| 23 | #include "Poco/FileStream.h" |
| 24 | |
| 25 | |
| 26 | namespace Poco { |
| 27 | |
| 28 | |
| 29 | class Foundation_API LogFileImpl |
| 30 | /// The implementation of LogFile for non-Windows platforms. |
| 31 | /// The native filesystem APIs are used for |
| 32 | /// total control over locking behavior. |
| 33 | { |
| 34 | public: |
| 35 | LogFileImpl(const std::string& path); |
| 36 | ~LogFileImpl(); |
| 37 | void writeImpl(const std::string& text, bool flush); |
| 38 | UInt64 sizeImpl() const; |
| 39 | Timestamp creationDateImpl() const; |
| 40 | const std::string& pathImpl() const; |
| 41 | |
| 42 | private: |
| 43 | std::string _path; |
| 44 | mutable Poco::FileOutputStream _str; |
| 45 | Timestamp _creationDate; |
| 46 | UInt64 _size; |
| 47 | }; |
| 48 | |
| 49 | |
| 50 | } // namespace Poco |
| 51 | |
| 52 | |
| 53 | #endif // Foundation_LogFile_STD_INCLUDED |
| 54 | |