#include <LogFile.h>
Inherits LogBufferSink, and RefCountObj.

| 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 | 
| MetaInfo * | m_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< LogFile > | link | 
Definition at line 125 of file LogFile.h.
| anonymous enum | 
| 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.
| 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 | ( | ) | 
Definition at line 750 of file LogFile.cc.
References close_file(), Log::config, exists(), LogUtils::LOG_ALARM_ERROR, LOG_FILE_NO_ERROR, LOG_FILE_NO_PIPE_READERS, LogUtils::manager_alarm(), open_file(), and Warning.
Referenced by Log::flush_thread_main().
| 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 | ( | ) | 
Definition at line 163 of file LogFile.cc.
References Log::config, Debug, do_filesystem_checks(), Error, exists(), is_open(), LOG_FILE_BINARY, LOG_FILE_PIPE, log_rsb, log_stat_log_files_open_stat, LogConfig::logfile_perm, m_bytes_written, m_fd, m_file_format, m_header, m_meta_info, m_signature, RecIncrRawStat(), this_thread(), LogUtils::timestamp(), and writeln().
Referenced by check_fd().
| int LogFile::preproc_and_try_delete | ( | LogBuffer * | lb | ) | 
Definition at line 445 of file LogFile.cc.
References LogBufferHeader::byte_count, LogBuffer::destroy(), LogBufferHeader::entry_count, Log::flush_data_list, Log::flush_notify, LogBuffer::header(), LogBufferHeader::high_timestamp, ink_atomiclist_push(), LOG_FILE_ASCII, LOG_FILE_BINARY, LOG_FILE_PIPE, log_rsb, log_stat_bytes_flush_to_disk_stat, log_stat_num_flush_to_disk_stat, LogBufferHeader::low_timestamp, m_end_time, m_file_format, LogBuffer::m_references, m_start_time, Thread::mutex, Note, RecIncrRawStat(), EventNotify::signal(), this_thread(), ProxyMutex::thread_holding, and write_ascii_logbuffer3().
| void LogFile::read_metadata | ( | ) | 
| int LogFile::roll | ( | long | interval_start, | |
| long | interval_end | |||
| ) | 
Definition at line 325 of file LogFile.cc.
References close_file(), MetaInfo::data_from_metafile(), Debug, exists(), MetaInfo::get_creation_time(), Machine::instance(), LOGFILE_ROLLED_EXTENSION, LOGFILE_SEPARATOR_STRING, m_bytes_written, m_end_time, m_meta_info, m_start_time, Note, start, LogUtils::timestamp_to_str(), and Warning.
| 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] | 
Definition at line 530 of file LogFile.cc.
References Log::config, LogBufferHeader::fmt_fieldlist(), LogBufferHeader::fmt_printf(), LogBufferHeader::format_type, ink_assert, LOG_MAX_FORMATTED_BUFFER, LOG_MAX_FORMATTED_LINE, LOG_SEGMENT_VERSION, memcpy, LogBufferIterator::next(), Note, LogBuffer::to_ascii(), LogBufferHeader::version, and writeln().
Referenced by process_file().
| int LogFile::write_ascii_logbuffer3 | ( | LogBufferHeader * | buffer_header, | |
| const char * | alt_format = NULL | |||
| ) | 
Definition at line 594 of file LogFile.cc.
References Debug, LogEntryHeader::entry_len, Error, Log::flush_data_list, Log::flush_notify, LogBufferHeader::fmt_fieldlist(), LogBufferHeader::fmt_printf(), LogBufferHeader::format_type, ink_assert, ink_atomiclist_push(), LOG_FILE_PIPE, log_rsb, LOG_SEGMENT_VERSION, log_stat_bytes_flush_to_disk_stat, log_stat_bytes_lost_before_flush_to_disk_stat, log_stat_num_flush_to_disk_stat, log_stat_num_lost_before_flush_to_disk_stat, m_ascii_buffer_size, m_file_format, m_max_line_size, Thread::mutex, LogBufferIterator::next(), Note, RecIncrRawStat(), EventNotify::signal(), this_thread(), ProxyMutex::thread_holding, LogBuffer::to_ascii(), LogBufferHeader::version, and Warning.
Referenced by preproc_and_try_delete().
| 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().
| size_t LogFile::m_ascii_buffer_size | 
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().
| long LogFile::m_end_time | 
Definition at line 190 of file LogFile.h.
Referenced by LogFile(), preproc_and_try_delete(), and roll().
| int LogFile::m_fd | 
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 177 of file LogFile.h.
Referenced by Log::flush_thread_main(), get_format(), get_format_name(), get_size_bytes(), open_file(), preproc_and_try_delete(), and write_ascii_logbuffer3().
| char* LogFile::m_header | 
Definition at line 181 of file LogFile.h.
Referenced by change_header(), open_file(), and ~LogFile().
| size_t LogFile::m_max_line_size | 
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().
| uint64_t LogFile::m_signature | 
Definition at line 182 of file LogFile.h.
Referenced by open_file().
| off_t LogFile::m_size_bytes | 
Definition at line 189 of file LogFile.h.
Referenced by LogFile(), preproc_and_try_delete(), and roll().
 1.7.1
 1.7.1