1//
2// LogFile.h
3//
4// Library: Foundation
5// Package: Logging
6// Module: LogFile
7//
8// Definition of the LogFile class.
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_INCLUDED
18#define Foundation_LogFile_INCLUDED
19
20
21#include "Poco/Foundation.h"
22
23
24#if defined(POCO_OS_FAMILY_WINDOWS)
25#include "Poco/LogFile_WIN32.h"
26#elif defined(POCO_OS_FAMILY_VMS)
27#include "Poco/LogFile_VMS.h"
28#else
29#include "Poco/LogFile_STD.h"
30#endif
31
32
33namespace Poco {
34
35
36class Foundation_API LogFile: public LogFileImpl
37 /// This class is used by FileChannel to work
38 /// with a log file.
39{
40public:
41 LogFile(const std::string& path);
42 /// Creates the LogFile.
43
44 ~LogFile();
45 /// Destroys the LogFile.
46
47 void write(const std::string& text, bool flush = true);
48 /// Writes the given text to the log file.
49 /// If flush is true, the text will be immediately
50 /// flushed to the file.
51
52 UInt64 size() const;
53 /// Returns the current size in bytes of the log file.
54
55 Timestamp creationDate() const;
56 /// Returns the date and time the log file was created.
57
58 const std::string& path() const;
59 /// Returns the path given in the constructor.
60};
61
62
63//
64// inlines
65//
66inline void LogFile::write(const std::string& text, bool flush)
67{
68 writeImpl(text, flush);
69}
70
71
72inline UInt64 LogFile::size() const
73{
74 return sizeImpl();
75}
76
77
78inline Timestamp LogFile::creationDate() const
79{
80 return creationDateImpl();
81}
82
83
84inline const std::string& LogFile::path() const
85{
86 return pathImpl();
87}
88
89
90} // namespace Poco
91
92
93#endif // Foundation_LogFile_INCLUDED
94