RStudio Launcher Plugin SDK  1.1.3
A software development kit for creating plugins that work the the RStudio Launcher.
Public Member Functions | List of all members
rstudio::launcher_plugins::logging::FileLogDestination Class Reference

Class which allows sending log messages to a file. More...

#include <FileLogDestination.hpp>

Inheritance diagram for rstudio::launcher_plugins::logging::FileLogDestination:
rstudio::launcher_plugins::logging::ILogDestination rstudio::launcher_plugins::Noncopyable

Public Member Functions

 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. More...
 
 ~FileLogDestination () override
 Destructor.
 
std::string path ()
 Returns the log destination.
 
void refresh (const RefreshParams &in_refreshParams=RefreshParams()) override
 Refreshes the log destintation. Ensures that the log does not have any stale file handles. More...
 
void writeLog (LogLevel in_logLevel, const std::string &in_message) override
 Writes a message to the log file. More...
 
- Public Member Functions inherited from rstudio::launcher_plugins::logging::ILogDestination
 ILogDestination (const std::string &in_id, LogLevel in_logLevel, LogMessageFormatType in_formatType, bool in_reloadable)
 Constructor. More...
 
virtual ~ILogDestination ()=default
 Virtual destructor to allow for inheritance.
 
std::string getId () const
 Gets the unique ID of the log destination. More...
 
LogLevel getLogLevel ()
 Gets the maximum level of logs that will be written to this log destination. More...
 
LogMessageFormatType getLogMessageFormatType ()
 Gets the log message format type for this log destination. More...
 
bool isReloadable () const
 Gets whether or not the log destination is reloadable. More...
 

Additional Inherited Members

- Protected Attributes inherited from rstudio::launcher_plugins::logging::ILogDestination
std::string m_id
 The unique ID of the log destination.
 
LogLevel m_logLevel
 The maximum level of log messages to write for this logger.
 
LogMessageFormatType m_formatType
 The log message format type.
 
bool m_reloadable
 Whether or not the log destination is reloadable (i.e. it will be destroyed when the global logger is reinitialized).
 

Detailed Description

Class which allows sending log messages to a file.

Constructor & Destructor Documentation

◆ FileLogDestination()

rstudio::launcher_plugins::logging::FileLogDestination::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.

Parameters
in_idThe ID of this log destination. Must be unique for each log destination.
in_logLevelThe most detailed level of log to be written to this log file.
in_formatTypeThe format type for log messages.
in_programIdThe ID of this program.
in_logOptionsThe options for log file creation and management.
in_reloadableWhether or not the destination is reloadable. If so, reloading of logging configuration will cause the log destination to be removed. Set this to true only for log destinations that are intended to be hot-reconfigurable, such as the global default logger.

If the log file cannot be opened, no logs will be written to the file. If there are other log destinations registered an error will be logged regarding the failure.

Member Function Documentation

◆ refresh()

void rstudio::launcher_plugins::logging::FileLogDestination::refresh ( const RefreshParams in_refreshParams = RefreshParams())
overridevirtual

Refreshes the log destintation. Ensures that the log does not have any stale file handles.

Parameters
in_refreshParamsRefresh params to use when refreshing the log destinations (if applicable).

Implements rstudio::launcher_plugins::logging::ILogDestination.

◆ writeLog()

void rstudio::launcher_plugins::logging::FileLogDestination::writeLog ( LogLevel  in_logLevel,
const std::string &  in_message 
)
overridevirtual

Writes a message to the log file.

Parameters
in_logLevelThe log level of the message to write. Filtering is done prior to this call. This is for informational purposes only.
in_messageThe message to write to the log file.

Implements rstudio::launcher_plugins::logging::ILogDestination.


The documentation for this class was generated from the following file: