Public Types | Public Member Functions | Static Public Member Functions | Data Fields

LogFile Class Reference

#include <LogFile.h>

Inherits LogBufferSink, and RefCountObj.

Collaboration diagram for LogFile:
Collaboration graph
[legend]

Public Types

enum  {
  LOG_FILE_NO_ERROR = 0, LOG_FILE_NO_PIPE_READERS, LOG_FILE_COULD_NOT_CREATE_PIPE, LOG_FILE_PIPE_MODE_NOT_SUPPORTED,
  LOG_FILE_COULD_NOT_OPEN_FILE, LOG_FILE_FILESYSTEM_CHECKS_FAILED
}

Public Member Functions

 LogFile (const char *name, const char *header, LogFileFormat format, uint64_t signature, size_t ascii_buffer_size=4 *9216, size_t max_line_size=9216)
 LogFile (const LogFile &)
 ~LogFile ()
int preproc_and_try_delete (LogBuffer *lb)
int roll (long interval_start, long interval_end)
const char * get_name () const
void change_header (const char *header)
void change_name (const char *new_name)
LogFileFormat get_format () const
const char * get_format_name () const
int write_ascii_logbuffer3 (LogBufferHeader *buffer_header, const char *alt_format=NULL)
void display (FILE *fd=stdout)
int open_file ()
off_t get_size_bytes () const
int do_filesystem_checks ()
bool is_open ()
void close_file ()
void check_fd ()
void read_metadata ()

Static Public Member Functions

static int write_ascii_logbuffer (LogBufferHeader *buffer_header, int fd, const char *path, const char *alt_format=NULL)
static bool rolled_logfile (char *file)
static bool exists (const char *pathname)
static int writeln (char *data, int len, int fd, const char *path)

Data Fields

LogFileFormat m_file_format
char * m_header
uint64_t m_signature
MetaInfom_meta_info
size_t m_ascii_buffer_size
size_t m_max_line_size
int m_fd
long m_start_time
long m_end_time
volatile uint64_t m_bytes_written
off_t m_size_bytes
Link< LogFilelink

Detailed Description

Definition at line 125 of file LogFile.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
LOG_FILE_NO_ERROR 
LOG_FILE_NO_PIPE_READERS 
LOG_FILE_COULD_NOT_CREATE_PIPE 
LOG_FILE_PIPE_MODE_NOT_SUPPORTED 
LOG_FILE_COULD_NOT_OPEN_FILE 
LOG_FILE_FILESYSTEM_CHECKS_FAILED 

Definition at line 133 of file LogFile.h.


Constructor & Destructor Documentation

LogFile::LogFile ( const char *  name,
const char *  header,
LogFileFormat  format,
uint64_t  signature,
size_t  ascii_buffer_size = 4 * 9216,
size_t  max_line_size = 9216 
)

Definition at line 61 of file LogFile.cc.

References Debug, LogFile(), m_ascii_buffer_size, m_bytes_written, m_end_time, m_fd, m_meta_info, m_size_bytes, and m_start_time.

Referenced by LogFile().

LogFile::LogFile ( const LogFile copy  ) 

Definition at line 88 of file LogFile.cc.

References Debug, ink_release_assert, LogFile(), m_ascii_buffer_size, and m_max_line_size.

LogFile::~LogFile (  ) 

Definition at line 110 of file LogFile.cc.

References ats_free(), close_file(), Debug, m_header, and m_meta_info.


Member Function Documentation

void LogFile::change_header ( const char *  header  ) 

Definition at line 149 of file LogFile.cc.

References ats_free(), ats_strdup, and m_header.

void LogFile::change_name ( const char *  new_name  ) 

Definition at line 138 of file LogFile.cc.

References ats_free(), and ats_strdup.

void LogFile::check_fd (  ) 
void LogFile::close_file (  ) 

Definition at line 263 of file LogFile.cc.

References Debug, is_open(), log_rsb, log_stat_log_files_open_stat, m_fd, RecIncrRawStat(), and this_thread().

Referenced by check_fd(), roll(), and ~LogFile().

void LogFile::display ( FILE *  fd = stdout  ) 

Definition at line 784 of file LogFile.cc.

References get_name(), and is_open().

int LogFile::do_filesystem_checks (  )  [inline]

Definition at line 166 of file LogFile.h.

Referenced by open_file().

bool LogFile::exists ( const char *  pathname  )  [static]

Definition at line 127 of file LogFile.cc.

References ink_assert.

Referenced by check_fd(), open_file(), and roll().

LogFileFormat LogFile::get_format (  )  const [inline]

Definition at line 152 of file LogFile.h.

References m_file_format.

const char* LogFile::get_format_name (  )  const [inline]

Definition at line 153 of file LogFile.h.

References LOG_FILE_BINARY, LOG_FILE_PIPE, and m_file_format.

const char* LogFile::get_name (  )  const [inline]

Definition at line 147 of file LogFile.h.

Referenced by display(), and Log::flush_thread_main().

off_t LogFile::get_size_bytes (  )  const [inline]

Definition at line 165 of file LogFile.h.

References LOG_FILE_PIPE, m_bytes_written, and m_file_format.

Referenced by LogObject::get_file_size_bytes().

bool LogFile::is_open (  )  [inline]

Definition at line 169 of file LogFile.h.

References m_fd.

Referenced by close_file(), display(), Log::flush_thread_main(), and open_file().

int LogFile::open_file (  ) 
int LogFile::preproc_and_try_delete ( LogBuffer lb  ) 
void LogFile::read_metadata (  ) 
int LogFile::roll ( long  interval_start,
long  interval_end 
)
bool LogFile::rolled_logfile ( char *  file  )  [static]

Definition at line 282 of file LogFile.cc.

References LOGFILE_ROLLED_EXTENSION.

Referenced by LogConfig::update_space_used().

int LogFile::write_ascii_logbuffer ( LogBufferHeader buffer_header,
int  fd,
const char *  path,
const char *  alt_format = NULL 
) [static]
int LogFile::write_ascii_logbuffer3 ( LogBufferHeader buffer_header,
const char *  alt_format = NULL 
)
int LogFile::writeln ( char *  data,
int  len,
int  fd,
const char *  path 
) [static]

Definition at line 704 of file LogFile.cc.

References Warning.

Referenced by open_file(), and write_ascii_logbuffer().


Field Documentation

Definition at line 195 of file LogFile.h.

Definition at line 185 of file LogFile.h.

Referenced by LogFile(), and write_ascii_logbuffer3().

volatile uint64_t LogFile::m_bytes_written

Definition at line 191 of file LogFile.h.

Referenced by Log::flush_thread_main(), get_size_bytes(), LogFile(), open_file(), and roll().

Definition at line 190 of file LogFile.h.

Referenced by LogFile(), preproc_and_try_delete(), and roll().

Definition at line 188 of file LogFile.h.

Referenced by close_file(), Log::flush_thread_main(), is_open(), LogFile(), and open_file().

Definition at line 181 of file LogFile.h.

Referenced by change_header(), open_file(), and ~LogFile().

Definition at line 186 of file LogFile.h.

Referenced by LogFile(), and write_ascii_logbuffer3().

Definition at line 183 of file LogFile.h.

Referenced by LogFile(), open_file(), roll(), and ~LogFile().

Definition at line 182 of file LogFile.h.

Referenced by open_file().

Definition at line 192 of file LogFile.h.

Referenced by LogFile().

Definition at line 189 of file LogFile.h.

Referenced by LogFile(), preproc_and_try_delete(), and roll().


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