WPILibC++ 2025.1.1
Loading...
Searching...
No Matches
wpi::FileLogger Class Reference

A class version of tail -f, otherwise known as tail -f at home. More...

#include <wpi/FileLogger.h>

Public Member Functions

 FileLogger ()=default
 
 FileLogger (std::string_view file, std::function< void(std::string_view)> callback)
 Construct a FileLogger.
 
 FileLogger (std::string_view file, log::DataLog &log, std::string_view key)
 Construct a FileLogger.
 
 FileLogger (FileLogger &&other)
 
FileLoggeroperator= (FileLogger &&rhs)
 
 ~FileLogger ()
 

Static Public Member Functions

static std::function< void(std::string_view)> Buffer (std::function< void(std::string_view)> callback)
 Creates a function that chunks incoming data into blocks of whole lines and stores incomplete lines to add to the next block of data.
 

Detailed Description

A class version of tail -f, otherwise known as tail -f at home.

Watches a file and puts the data somewhere else. Only works on Linux-based platforms.

Constructor & Destructor Documentation

◆ FileLogger() [1/4]

wpi::FileLogger::FileLogger ( )
default

◆ FileLogger() [2/4]

wpi::FileLogger::FileLogger ( std::string_view file,
std::function< void(std::string_view)> callback )

Construct a FileLogger.

When the specified file is modified, the callback will be called with the appended changes.

Parameters
fileThe path to the file.
callbackA callback that accepts the appended file data.

◆ FileLogger() [3/4]

wpi::FileLogger::FileLogger ( std::string_view file,
log::DataLog & log,
std::string_view key )

Construct a FileLogger.

When the specified file is modified, appended data will be appended to the specified data log.

Parameters
fileThe path to the file.
logA data log.
keyThe log key to append data to.

◆ FileLogger() [4/4]

wpi::FileLogger::FileLogger ( FileLogger && other)

◆ ~FileLogger()

wpi::FileLogger::~FileLogger ( )

Member Function Documentation

◆ Buffer()

static std::function< void(std::string_view)> wpi::FileLogger::Buffer ( std::function< void(std::string_view)> callback)
static

Creates a function that chunks incoming data into blocks of whole lines and stores incomplete lines to add to the next block of data.

Parameters
callbackA callback that accepts the blocks of whole lines.
Returns
The function.

◆ operator=()

FileLogger & wpi::FileLogger::operator= ( FileLogger && rhs)

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