mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-28 03:20:11 +01:00
This commit is contained in:
@@ -70,7 +70,7 @@ class Foundation_API SimpleFileChannel: public Channel
|
|||||||
/// The flush property specifies whether each log message is flushed
|
/// The flush property specifies whether each log message is flushed
|
||||||
/// immediately to the log file (which may hurt application performance,
|
/// immediately to the log file (which may hurt application performance,
|
||||||
/// but ensures that everything is in the log in case of a system crash),
|
/// but ensures that everything is in the log in case of a system crash),
|
||||||
// or whether it's allowed to stay in the system's file buffer for some time.
|
/// or whether it's allowed to stay in the system's file buffer for some time.
|
||||||
/// Valid values are:
|
/// Valid values are:
|
||||||
///
|
///
|
||||||
/// * true: Every message is immediately flushed to the log file (default).
|
/// * true: Every message is immediately flushed to the log file (default).
|
||||||
@@ -86,16 +86,16 @@ public:
|
|||||||
SimpleFileChannel(const std::string& path);
|
SimpleFileChannel(const std::string& path);
|
||||||
/// Creates the FileChannel for a file with the given path.
|
/// Creates the FileChannel for a file with the given path.
|
||||||
|
|
||||||
void open();
|
void open() override;
|
||||||
/// Opens the FileChannel and creates the log file if necessary.
|
/// Opens the FileChannel and creates the log file if necessary.
|
||||||
|
|
||||||
void close();
|
void close() override;
|
||||||
/// Closes the FileChannel.
|
/// Closes the FileChannel.
|
||||||
|
|
||||||
void log(const Message& msg);
|
void log(const Message& msg) override;
|
||||||
/// Logs the given message to the file.
|
/// Logs the given message to the file.
|
||||||
|
|
||||||
void setProperty(const std::string& name, const std::string& value);
|
void setProperty(const std::string& name, const std::string& value) override;
|
||||||
/// Sets the property with the given name.
|
/// Sets the property with the given name.
|
||||||
///
|
///
|
||||||
/// The following properties are supported:
|
/// The following properties are supported:
|
||||||
@@ -107,7 +107,7 @@ public:
|
|||||||
/// flushed to the log file. See the SimpleFileChannel
|
/// flushed to the log file. See the SimpleFileChannel
|
||||||
/// class for details.
|
/// class for details.
|
||||||
|
|
||||||
std::string getProperty(const std::string& name) const;
|
std::string getProperty(const std::string& name) const override;
|
||||||
/// Returns the value of the property with the given name.
|
/// Returns the value of the property with the given name.
|
||||||
/// See setProperty() for a description of the supported
|
/// See setProperty() for a description of the supported
|
||||||
/// properties.
|
/// properties.
|
||||||
@@ -130,7 +130,7 @@ public:
|
|||||||
static const std::string PROP_FLUSH;
|
static const std::string PROP_FLUSH;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
~SimpleFileChannel();
|
~SimpleFileChannel() override;
|
||||||
void setRotation(const std::string& rotation);
|
void setRotation(const std::string& rotation);
|
||||||
void setFlush(const std::string& flush);
|
void setFlush(const std::string& flush);
|
||||||
void rotate();
|
void rotate();
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ const std::string SimpleFileChannel::PROP_FLUSH = "flush";
|
|||||||
|
|
||||||
SimpleFileChannel::SimpleFileChannel():
|
SimpleFileChannel::SimpleFileChannel():
|
||||||
_limit(0),
|
_limit(0),
|
||||||
_flush(true),
|
_flush(false),
|
||||||
_pFile(0)
|
_pFile(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,8 +42,8 @@ SimpleFileChannel::SimpleFileChannel(const std::string& path):
|
|||||||
_path(path),
|
_path(path),
|
||||||
_secondaryPath(path + ".0"),
|
_secondaryPath(path + ".0"),
|
||||||
_limit(0),
|
_limit(0),
|
||||||
_flush(true),
|
_flush(false),
|
||||||
_pFile(0)
|
_pFile(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ void SimpleFileChannel::close()
|
|||||||
FastMutex::ScopedLock lock(_mutex);
|
FastMutex::ScopedLock lock(_mutex);
|
||||||
|
|
||||||
delete _pFile;
|
delete _pFile;
|
||||||
_pFile = 0;
|
_pFile = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@ std::string SimpleFileChannel::getProperty(const std::string& name) const
|
|||||||
else if (name == PROP_ROTATION)
|
else if (name == PROP_ROTATION)
|
||||||
return _rotation;
|
return _rotation;
|
||||||
else if (name == PROP_FLUSH)
|
else if (name == PROP_FLUSH)
|
||||||
return std::string(_flush ? "true" : "false");
|
return (_flush ? "true"s : "false"s);
|
||||||
else
|
else
|
||||||
return Channel::getProperty(name);
|
return Channel::getProperty(name);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user