| 100 | -------------------------------------------------------------------------*/ |
| 101 | |
| 102 | LogObject::LogObject(LogConfig *cfg, const LogFormat *format, const char *log_dir, const char *basename, LogFileFormat file_format, |
| 103 | const char *header, Log::RollingEnabledValues rolling_enabled, int flush_threads, int rolling_interval_sec, |
| 104 | int rolling_offset_hr, int rolling_size_mb, bool /* auto_created ATS_UNUSED */, int rolling_max_count, |
| 105 | int rolling_min_count, bool reopen_after_rolling, int pipe_buffer_size, bool fast) |
| 106 | : m_alt_filename(nullptr), |
| 107 | m_flags(0), |
| 108 | m_signature(0), |
| 109 | m_flush_threads(flush_threads), |
| 110 | m_rolling_interval_sec(rolling_interval_sec), |
| 111 | m_rolling_offset_hr(rolling_offset_hr), |
| 112 | m_rolling_size_mb(rolling_size_mb), |
| 113 | m_last_roll_time(0), |
| 114 | m_max_rolled(rolling_max_count), |
| 115 | m_min_rolled(rolling_min_count), |
| 116 | m_reopen_after_rolling(reopen_after_rolling), |
| 117 | m_buffer_manager_idx(0), |
| 118 | m_pipe_buffer_size(pipe_buffer_size), |
| 119 | m_fast(fast) |
| 120 | { |
| 121 | ink_release_assert(format); |
| 122 | m_format = new LogFormat(*format); |
| 123 | m_buffer_manager = new LogBufferManager[m_flush_threads]; |
| 124 | |
| 125 | if (file_format == LOG_FILE_BINARY) { |
| 126 | m_flags |= BINARY; |
| 127 | } else if (file_format == LOG_FILE_PIPE) { |
| 128 | m_flags |= WRITES_TO_PIPE; |
| 129 | } |
| 130 | |
| 131 | generate_filenames(log_dir, basename, file_format); |
| 132 | |
| 133 | // compute_signature is a static function |
| 134 | m_signature = compute_signature(m_format, m_basename, m_flags); |
| 135 | |
| 136 | m_logFile = new LogFile(m_filename, header, file_format, m_signature, cfg->ascii_buffer_size, cfg->max_line_size, |
| 137 | m_pipe_buffer_size, format->escape_type()); |
| 138 | |
| 139 | if (m_reopen_after_rolling) { |
| 140 | m_logFile->open_file(); |
| 141 | } |
| 142 | |
| 143 | if (!m_fast) { |
| 144 | LogBuffer *b = new LogBuffer(cfg, this, cfg->log_buffer_size); |
| 145 | ink_assert(b); |
| 146 | SET_FREELIST_POINTER_VERSION(m_log_buffer, b, 0); |
| 147 | } |
| 148 | _setup_rolling(cfg, rolling_enabled, rolling_interval_sec, rolling_offset_hr, rolling_size_mb); |
| 149 | |
| 150 | Dbg(dbg_ctl_log_config, "exiting LogObject constructor, filename=%s this=%p fast=%d", m_filename, this, m_fast); |
| 151 | } |
| 152 | |
| 153 | LogObject::~LogObject() |
| 154 | { |
nothing calls this directly
no test coverage detected