MySQL 9.1.0
Source Code Documentation
Logfile Class Reference

#include <logfile.h>

Public Member Functions

 Logfile ()
 
 Logfile (const Logfile &)=default
 
virtual ~Logfile ()
 
const char * file_name () const
 Return file name. More...
 
std::size_t bytes_written () const
 Return number bytes written into a log file. More...
 
bool flush ()
 Flush any unwritten content from the stream's buffer to the associated file. More...
 
bool open (const char *dirname, const char *filename, const char *ext)
 Construct a file path using directory name, file name and extension arguments and open it in write/update mode. More...
 
bool write (const char *data, std::size_t length)
 Write the contents in data array to a file. More...
 
void show_tail (unsigned int lines)
 Print the last N number of lines from a file to stderr. More...
 

Private Member Functions

void close ()
 Close the given file stream. More...
 

Private Attributes

char m_filename [FN_REFLEN]
 
FILE * m_file
 
std::size_t m_bytes_written
 

Constructor & Destructor Documentation

◆ Logfile() [1/2]

Logfile::Logfile ( )

◆ Logfile() [2/2]

Logfile::Logfile ( const Logfile )
default

◆ ~Logfile()

virtual Logfile::~Logfile ( )
inlinevirtual

Member Function Documentation

◆ bytes_written()

std::size_t Logfile::bytes_written ( ) const
inline

Return number bytes written into a log file.

Return values
Numberbytes written into a log file.

◆ close()

void Logfile::close ( )
private

Close the given file stream.

◆ file_name()

const char * Logfile::file_name ( ) const
inline

Return file name.

Return values
Nameof the file.

◆ flush()

bool Logfile::flush ( )

Flush any unwritten content from the stream's buffer to the associated file.

Return values
Falseif successful, true otherwise.

◆ open()

bool Logfile::open ( const char *  dirname,
const char *  filename,
const char *  ext 
)

Construct a file path using directory name, file name and extension arguments and open it in write/update mode.

Parameters
dirnameDirectory name
filenameFile name
extExtension name
Return values
Falseif successful, true otherwise.

◆ show_tail()

void Logfile::show_tail ( unsigned int  lines)

Print the last N number of lines from a file to stderr.

Parameters
linesNumber of lines

◆ write()

bool Logfile::write ( const char *  data,
std::size_t  length 
)

Write the contents in data array to a file.

Parameters
dataPointer to the array to be written
lengthLength of the buffer
Return values
Falseif successful, true otherwise.

Member Data Documentation

◆ m_bytes_written

std::size_t Logfile::m_bytes_written
private

◆ m_file

FILE* Logfile::m_file
private

◆ m_filename

char Logfile::m_filename[FN_REFLEN]
private

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