RStudio Launcher Plugin SDK
1.1.3
A software development kit for creating plugins that work the the RStudio Launcher.
|
24 #ifndef LAUNCHER_PLUGINS_FILE_LOG_DESTINATION_HPP
25 #define LAUNCHER_PLUGINS_FILE_LOG_DESTINATION_HPP
27 #include <logging/ILogDestination.hpp>
32 #include <system/FilePath.hpp>
35 namespace launcher_plugins {
80 std::string in_fileMode,
88 bool in_forceLogDirectory);
235 static constexpr
const char* s_defaultFileMode =
"600";
236 static constexpr
int s_defaultMaxSizeMb = 2;
237 static constexpr
int s_defaultRotationDays = 1;
238 static constexpr
int s_defaultMaxRotations = 100;
239 static constexpr
int s_defaultDeletionDays = 30;
240 static constexpr
bool s_defaultDoRotation =
true;
241 static constexpr
bool s_defaultIncludePid =
false;
242 static constexpr
bool s_defaultWarnSyslog =
true;
243 static constexpr
bool s_defaultForceDirectory =
false;
249 std::string m_fileMode;
273 bool m_forceDirectory;
298 const std::string& in_id,
301 const std::string& in_programId,
303 bool in_reloadable =
false);
329 void writeLog(
LogLevel in_logLevel,
const std::string& in_message)
override;
332 PRIVATE_IMPL_SHARED(m_impl);
void setDirectory(const system::FilePath &in_directory)
Sets the directory where log files should be written.
Class which represents a path on the system. May be any type of file (e.g. directory,...
Definition: FilePath.hpp:77
FileLogDestination(const std::string &in_id, LogLevel in_logLevel, LogMessageFormatType in_formatType, const std::string &in_programId, FileLogOptions in_logOptions, bool in_reloadable=false)
Constructor.
Interface which allows a logger to write a log message to a destination.
Definition: ILogDestination.hpp:40
const system::FilePath & getDirectory() const
Gets the directory where log files should be written.
void setWarnSyslog(bool in_warnSyslog)
Sets whether or not to also send warn/error logs to syslog for admin visibility.
int getMaxRotations() const
Gets the maximum number of allowed rotated log files.
void setIncludePid(bool in_includePid)
Sets whether or not to include the PID of the process in the log filename.
const std::string & getFileMode() const
Gets the permissions with which log files should be created.
void refresh(const RefreshParams &in_refreshParams=RefreshParams()) override
Refreshes the log destintation. Ensures that the log does not have any stale file handles.
Class which represents the options for a file logger.
Definition: FileLogDestination.hpp:41
LogLevel
Enum which represents the level of detail at which to log messages.
Definition: Logger.hpp:86
void setMaxRotations(int in_maxRotations)
Sets the maximum number of allowed rotated log files.
void setRotationDays(int in_rotationDays)
Sets the number of days a log file should persist before being rotated.
A struct encapsulating various params to pass when refreshing log destinations. This carries data tha...
Definition: Logger.hpp:67
bool warnSyslog() const
Returns whether or not to also send warn/error logs to syslog for admin visibility.
void setDeletionDays(int in_deletionDays)
Sets the number of days a rotated log file should persist before being deleted.
bool doRotation() const
Returns whether or not to rotate log files before overwriting them.
void setForceDirectory(bool in_forceDirectory)
Sets whether or not the log directory is forced, preventing user override.
bool includePid() const
Returns whether or not to include the PID in the log filename.
bool getForceDirectory() const
Gets whether or not the log directory is forced, preventing user override.
void setFileMode(const std::string &in_fileMode)
Sets the permissions with which the log files should be created.
int getDeletionDays() const
Gets the number of days a rotated log file should persist before being deleted.
void setMaxSizeMb(double in_maxSizeMb)
Sets the maximum size of the log files, in MB.
void setDoRotation(bool in_doRotation)
Sets whether or not to rotate log files before overwriting them.
LogMessageFormatType
Enum which represents the format type for log messages.
Definition: Logger.hpp:107
int getRotationDays() const
Gets the number of days a log file should persist before being rotated.
Class which allows sending log messages to a file.
Definition: FileLogDestination.hpp:279
double getMaxSizeMb() const
Gets the maximum size of log files, in MB.
~FileLogDestination() override
Destructor.
std::string path()
Returns the log destination.
void writeLog(LogLevel in_logLevel, const std::string &in_message) override
Writes a message to the log file.
FileLogOptions(system::FilePath in_directory)
Constructor.