|
static bool | init_logging (const std::string &logfile, LOGLEVEL max_level, bool to_stderr, bool to_syslog) |
| Initialise the logging facility. More...
|
|
template<typename T , typename... Args> |
static void | trace (const T filename, const std::string &format_string, Args &&...args) |
| Write trace level log entry. More...
|
|
template<typename T , typename... Args> |
static void | debug (const T filename, const std::string &format_string, Args &&...args) |
| Write debug level log entry. More...
|
|
template<typename T , typename... Args> |
static void | info (const T filename, const std::string &format_string, Args &&...args) |
| Write info level log entry. More...
|
|
template<typename T , typename... Args> |
static void | warning (const T filename, const std::string &format_string, Args &&...args) |
| Write warning level log entry. More...
|
|
template<typename T , typename... Args> |
static void | error (const T filename, const std::string &format_string, Args &&...args) |
| Write error level log entry. More...
|
|
static void | log_with_level (LOGLEVEL loglevel, const char *filename, const std::string &message) |
| Write log entry. More...
|
|
static void | log_with_level (LOGLEVEL loglevel, const std::string &filename, const std::string &message) |
| Write log entry. More...
|
|
static bool | show (LOGLEVEL loglevel) |
| Check if log entry should be displayed at the current log level. More...
|
|
|
template<typename T > |
static T & | convert (T &val) |
| Dummy: return orignal value unchanged. More...
|
|
static std::string | convert (const char *val) |
| Convert const char* to std::string. More...
|
|
static std::string | convert (char *val) |
| Convert char* to std::string. More...
|
|
template<class T , typename std::enable_if<!std::is_same< T, std::string >::value, bool >::type = true> |
static T & | fix_std_string (T &val) |
| Dummy: return orignal value unchanged if not type std::string. More...
|
|
static const char * | fix_std_string (const std::string &val) |
| Convert std::string to const char*. More...
|
|
static std::string | format_helper (const std::string &string_to_update, const size_t __attribute__((unused)) index_to_replace) |
| Standard format_helper without parameters. More...
|
|
template<typename T , typename... Args> |
static std::string | format_helper (const std::string &string_to_search, const size_t index_to_replace, T &&val, Args &&...args) |
| format_helper with variadic parameters. More...
|
|
template<typename... Args> |
static std::string | format (const std::string &format_string, Args &&...args) |
| format string with single token More...
|
|
Logging facility
Within the log message text, escape sequences are supported for dynamically formatting the message.
Escape sequences have either the form n or %<format specifier>n, where the index n starts at 1.
The index specifies the position of the argument in the list. They can appear in any given order. An index can be used more than once, and not all indexes have to be present (in which case the argument will not be printed). The input value is automatically converted to string format and can be among std::string, char *, int, uint64_t and more.
The format specifier is the same as used in printf and sprintf.
int channels = 2;
int sample_rate = 44100:
Logging::debug(filename,
"Audio %1 channels %2 Hz", channels, sample_rate);
static void debug(const T filename, const std::string &format_string, Args &&...args)
Write debug level log entry.
Prints "Audio 2 channels 44100 Hz".
int channels = 2;
double sample_rate = 44.1:
Logging::debug(filename,
"Audio %1 %<.3f>2 KHz", channels == 2 ?
"stereo" :
"mono", sample_rate);
Prints "Audio stereo 44.100 KHz".
Definition at line 79 of file logging.h.
template<typename T , typename... Args>
static void Logging::debug |
( |
const T |
filename, |
|
|
const std::string & |
format_string, |
|
|
Args &&... |
args |
|
) |
| |
|
inlinestatic |
Write debug level log entry.
- Parameters
-
[in] | filename | - Name of the file for which this log entry was written. May be empty. |
[in] | format_string | - Format a string in FFmpegfs logger format. |
[in] | args | - 0 or more format arguments. See format. |
Definition at line 182 of file logging.h.
References format_helper(), log_with_level(), LOGDEBUG, and show().
Referenced by FFmpeg_Transcoder::add_albumart_stream(), FFmpeg_Transcoder::add_external_subtitle_stream(), FFmpeg_Transcoder::add_stream(), FFmpeg_Transcoder::add_subtitle_stream(), FFmpeg_Base::audio_info(), FFmpeg_Transcoder::can_copy_stream(), create_dvd_virtualfile(), FFmpeg_Transcoder::decode_frame(), FFmpeg_Transcoder::decode_video_frame(), ffmpegfs_getattr(), ffmpegfs_readdir(), FFmpeg_Transcoder::get_hw_pix_fmt(), get_source_properties(), FFmpeg_Transcoder::init_deinterlace_filters(), FFmpeg_Transcoder::init_resampler(), FFmpeg_Transcoder::init_rescaler(), kick_next(), link_up(), Cache::load_index(), FFmpeg_Transcoder::open_bestmatch_video(), FFmpeg_Transcoder::open_decoder(), Buffer::open_file(), FFmpeg_Transcoder::open_input_file(), FFmpeg_Transcoder::open_output_file(), FFmpeg_Transcoder::open_output_filestreams(), FFmpeg_Transcoder::open_output_frame_set(), BlurayIO::openio(), DiskIO::openio(), DvdIO::openio(), Cache_Entry::outdated(), parse_bluray(), parse_dvd(), parse_file(), parse_vcd(), prepare_script(), FFmpeg_Base::subtitle_info(), thread_pool::tear_down(), transcode(), transcode_finish(), transcoder_free(), transcoder_init(), transcoder_new(), Cache::upgrade_db(), and FFmpeg_Base::video_info().
template<typename T , typename... Args>
static void Logging::error |
( |
const T |
filename, |
|
|
const std::string & |
format_string, |
|
|
Args &&... |
args |
|
) |
| |
|
inlinestatic |
Write error level log entry.
- Parameters
-
[in] | filename | - Name of the file for which this log entry was written. May be empty. |
[in] | format_string | - Format a string in FFmpegfs logger format. |
[in] | args | - 0 or more format arguments. See format. |
Definition at line 239 of file logging.h.
References format_helper(), log_with_level(), LOGERROR, and show().
Referenced by FFmpeg_Transcoder::add_albumart_frame(), FFmpeg_Transcoder::add_albumart_stream(), FFmpeg_Transcoder::add_external_subtitle_stream(), FFmpeg_Transcoder::add_external_subtitle_streams(), FFmpeg_Transcoder::add_samples_to_fifo(), FFmpeg_Transcoder::add_stream(), FFmpeg_Transcoder::add_stream_copy(), FFmpeg_Transcoder::add_subtitle_stream(), FFmpeg_Transcoder::alloc_picture(), audio_stream_info(), Cache::begin_transaction(), check_cuesheet(), Cache::check_min_version(), Buffer::clear(), Cache::close_index(), Cache::column_exists(), FFmpeg_Transcoder::convert_samples(), Buffer::copy(), FFmpeg_Transcoder::create_audio_frame(), create_bluray_virtualfile(), create_cuesheet_virtualfile(), create_dvd_virtualfile(), Cache::create_table_cache_entry(), create_vcd_virtualfile(), FFmpeg_Transcoder::decode(), FFmpeg_Transcoder::decode_audio_frame(), FFmpeg_Transcoder::decode_frame(), FFmpeg_Transcoder::decode_subtitle(), FFmpeg_Transcoder::decode_video_frame(), FFmpeg_Base::dict_set_with_check(), FFmpeg_Transcoder::encode_audio_frame(), FFmpeg_Transcoder::encode_image_frame(), FFmpeg_Transcoder::encode_subtitle(), FFmpeg_Transcoder::encode_video_frame(), Cache::end_transaction(), ffmpegfs_fgetattr(), ffmpegfs_read(), ffmpegfs_readdir(), ffmpegfs_release(), find_original(), Buffer::flush(), FFmpeg_Transcoder::flush_delayed_audio(), FFmpeg_Transcoder::flush_delayed_video(), FFmpeg_Transcoder::foreach_subtitle_file(), FFmpeg_Transcoder::get_format(), FFmpeg_Transcoder::get_hw_pix_fmt(), FFmpeg_Transcoder::hwdevice_ctx_add_ref(), FFmpeg_Transcoder::hwdevice_ctx_create(), FFmpeg_Transcoder::hwframe_copy_from_hw(), FFmpeg_Transcoder::hwframe_copy_to_hw(), FFmpeg_Transcoder::hwframe_ctx_set(), Buffer::init(), FFmpeg_Transcoder::init_audio_fifo(), FFmpeg_Transcoder::init_audio_output_frame(), FFmpeg_Transcoder::init_converted_samples(), FFmpeg_Transcoder::init_deinterlace_filters(), FFmpeg_Transcoder::init_resampler(), FFmpeg_Transcoder::init_rescaler(), FFmpeg_Transcoder::input_read(), link_down(), link_up(), Cache::load_index(), Buffer::map_file(), FFmpeg_Transcoder::open_albumarts(), FFmpeg_Transcoder::open_bestmatch_audio(), FFmpeg_Transcoder::open_bestmatch_decoder(), FFmpeg_Transcoder::open_bestmatch_video(), FFmpeg_Transcoder::open_decoder(), FFmpeg_Transcoder::open_input_file(), FFmpeg_Transcoder::open_output_file(), FFmpeg_Transcoder::open_output_filestreams(), FFmpeg_Transcoder::open_output_frame_set(), FFmpeg_Transcoder::open_subtitles(), BlurayIO::openio(), DvdIO::openio(), FFmpeg_Base::opt_set_with_check(), FFmpeg_Transcoder::output_write(), parse_cuesheet(), parse_dvd(), parse_file(), Cache::prepare_stmts(), FFmpeg_Transcoder::process_single_fr(), FFmpeg_Transcoder::read_decode_convert_and_store(), Cache::read_info(), BlurayIO::readio(), DvdIO::readio(), Buffer::reserve(), Cache::rollback_transaction(), FFmpeg_Transcoder::seek(), FFmpeg_Transcoder::send_filters(), FFmpeg_Transcoder::skip_decoded_frames(), FFmpeg_Transcoder::stack_seek_frame(), FFmpeg_Transcoder::stack_seek_segment(), FFmpeg_Transcoder::start_new_segment(), start_timer(), stop_timer(), FFmpeg_Transcoder::store_packet(), Cache::table_exists(), transcoder_init(), transcoder_read_frame(), transcoder_set_filesize(), transcoder_thread(), Buffer::unmap_file(), Cache::upgrade_db(), video_stream_info(), FFmpeg_Transcoder::write_output_file_header(), and FFmpeg_Transcoder::write_output_file_trailer().
template<class T , typename std::enable_if<!std::is_same< T, std::string >::value, bool >::type = true>
static T & Logging::fix_std_string |
( |
T & |
val | ) |
|
|
inlinestaticprivate |
Dummy: return orignal value unchanged if not type std::string.
- Parameters
-
- Returns
- Reference to original value.
Definition at line 331 of file logging.h.
Referenced by format_helper().
template<typename T , typename... Args>
static std::string Logging::format_helper |
( |
const std::string & |
string_to_search, |
|
|
const size_t |
index_to_replace, |
|
|
T && |
val, |
|
|
Args &&... |
args |
|
) |
| |
|
inlinestaticprivate |
format_helper with variadic parameters.
Calls itself recursively until all tokens are replaced.
- Parameters
-
[in] | string_to_search | - format string to be searched. |
[in] | index_to_replace | - index number (n) to be replaced. May be present 0...x times. |
[in] | val | - Replacement value to fill in tokens. |
[in] | args | - Further arguments. |
- Returns
- Contents of string_to_search with all tokens replaced.
Definition at line 368 of file logging.h.
References convert(), fix_std_string(), and format_helper().
template<typename T , typename... Args>
static void Logging::info |
( |
const T |
filename, |
|
|
const std::string & |
format_string, |
|
|
Args &&... |
args |
|
) |
| |
|
inlinestatic |
Write info level log entry.
- Parameters
-
[in] | filename | - Name of the file for which this log entry was written. May be empty. |
[in] | format_string | - Format a string in FFmpegfs logger format. |
[in] | args | - 0 or more format arguments. See format. |
Definition at line 201 of file logging.h.
References format_helper(), log_with_level(), LOGINFO, and show().
Referenced by FFmpeg_Transcoder::can_copy_stream(), ffmpegfs_destroy(), ffmpegfs_init(), thread_pool::init(), link_down(), link_up(), maintenance_handler(), master_check(), FFmpeg_Transcoder::open_bestmatch_video(), FFmpeg_Transcoder::open_decoder(), FFmpeg_Transcoder::open_output(), FFmpeg_Transcoder::open_output_filestreams(), VcdIO::openio(), FFmpeg_Transcoder::start_new_segment(), stop_timer(), transcode(), transcode_until(), transcoder_thread(), and Cache::upgrade_db().
template<typename T , typename... Args>
static void Logging::trace |
( |
const T |
filename, |
|
|
const std::string & |
format_string, |
|
|
Args &&... |
args |
|
) |
| |
|
inlinestatic |
Write trace level log entry.
- Parameters
-
[in] | filename | - Name of the file for which this log entry was written. May be empty. |
[in] | format_string | - Format a string in FFmpegfs logger format. |
[in] | args | - 0 or more format arguments. See format. |
Definition at line 163 of file logging.h.
References format_helper(), log_with_level(), LOGTRACE, and show().
Referenced by FFmpeg_Transcoder::add_albumart_frame(), FFmpeg_Transcoder::add_stream(), Cache_Entry::Cache_Entry(), check_bluray(), check_cuesheet(), check_dvd(), check_vcd(), Buffer::close_file(), FFmpeg_Transcoder::closeio(), Cache::closeio(), create_bluray_virtualfile(), create_dvd_virtualfile(), FFmpeg_Transcoder::encode_video_frame(), FFmpeg_Transcoder::FFmpeg_Transcoder(), ffmpegfs_fgetattr(), ffmpegfs_getattr(), ffmpegfs_open(), ffmpegfs_read(), ffmpegfs_readdir(), ffmpegfs_readlink(), ffmpegfs_release(), ffmpegfs_statfs(), get_format(), FFmpeg_Transcoder::init_rescaler(), thread_pool::loop_function(), Buffer::map_file(), master_check(), FFmpeg_Transcoder::open_albumarts(), FFmpeg_Transcoder::open_bestmatch_video(), FFmpeg_Transcoder::open_decoder(), Buffer::open_file(), Cache_Entry::openio(), Cache::openio(), DvdIO::openio(), parse_bluray(), parse_cuesheet_file(), parse_cuesheet_text(), parse_dvd(), parse_file(), prepare_script(), print_params(), FFmpeg_Transcoder::process_metadata(), FFmpeg_Transcoder::read_decode_convert_and_store(), Buffer::reallocate(), thread_pool::schedule_thread(), start_timer(), FFmpeg_Transcoder::store_packet(), transcode_until(), transcoder_new(), transcoder_predict_filesize(), transcoder_read(), transcoder_read_frame(), transcoder_set_filesize(), Buffer::unmap_file(), FFmpeg_Transcoder::update_codec(), FFmpeg_Transcoder::update_format(), Cache_Entry::~Cache_Entry(), and FFmpeg_Transcoder::~FFmpeg_Transcoder().
template<typename T , typename... Args>
static void Logging::warning |
( |
const T |
filename, |
|
|
const std::string & |
format_string, |
|
|
Args &&... |
args |
|
) |
| |
|
inlinestatic |
Write warning level log entry.
- Parameters
-
[in] | filename | - Name of the file for which this log entry was written. May be empty. |
[in] | format_string | - Format a string in FFmpegfs logger format. |
[in] | args | - 0 or more format arguments. See format. |
Definition at line 220 of file logging.h.
References format_helper(), log_with_level(), LOGWARN, and show().
Referenced by FFmpeg_Transcoder::calculate_predicted_filesize(), FFmpeg_Transcoder::encode_video_frame(), thread_pool::init(), Cache::load_index(), FFmpeg_Transcoder::open_input_file(), BlurayIO::openio(), parse_dvd(), prepare_script(), FFmpeg_Transcoder::purge(), DvdIO::readio(), Buffer::remove_file(), FFmpeg_Transcoder::send_filters(), sighandler(), transcode_until(), transcoder_read_frame(), transcoder_set_filesize(), transcoder_thread(), and FFmpeg_Base::video_stream_setup().