AvTranscoder  0.9.4
C++APIforLibav/FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
log.hpp
Go to the documentation of this file.
1 #ifndef _AV_TRANSCODER_LOG_HPP
2 #define _AV_TRANSCODER_LOG_HPP
3 
5 
6 extern "C" {
7 #include <libavutil/log.h>
8 }
9 
10 #include <sstream>
11 #include <fstream>
12 
13 namespace avtranscoder
14 {
15 
16 #define LOG_FILE "avtranscoder.log"
17 #define LOG_DEBUG(...) \
18  { \
19  std::stringstream os; \
20  os << __VA_ARGS__; \
21  Logger::log(AV_LOG_DEBUG, os.str()); \
22  }
23 #define LOG_INFO(...) \
24  { \
25  std::stringstream os; \
26  os << __VA_ARGS__; \
27  Logger::log(AV_LOG_INFO, os.str()); \
28  }
29 #define LOG_WARN(...) \
30  { \
31  std::stringstream os; \
32  os << __VA_ARGS__; \
33  Logger::log(AV_LOG_WARNING, os.str()); \
34  }
35 #define LOG_ERROR(...) \
36  { \
37  std::stringstream os; \
38  os << __VA_ARGS__; \
39  Logger::log(AV_LOG_ERROR, os.str()); \
40  }
41 
42 /// Logger class which contains static functions to use ffmpeg/libav log system
43 class AvExport Logger
44 {
45 public:
46  /**
47  * @brief Set the log level of ffmpeg/libav.
48  * @param level: refer to define AV_LOG_xxx (from AV_LOG_QUIET to AV_LOG_DEBUG)
49  * @note By default AV_LOG_INFO
50  * @see SWIG interface avLogLevel.i
51  */
52  static void setLogLevel(const int level);
53 
54  /**
55  * @brief Log with the ffmpeg/libav log system
56  * @note you can use macro LOG_* to log at DEBUG/INFO/WARN/ERROR level
57  * @param msg: the message will be prefixed by '[avTranscoder - <level>]'
58  * @param msg: the message will be suffixed by '\n'
59  */
60  static void log(const int level, const std::string& msg);
61 
62  /**
63  * @brief Log ffmpeg/libav and avtranscoder informations in a text file.
64  * @note log filename is avtranscoder.log
65  */
66  static void logInFile();
67 
68 private:
69  static std::string logHeaderMessage; ///< First caracters present for each logging message
70 };
71 }
72 
73 #endif
Logger class which contains static functions to use ffmpeg/libav log system.
Definition: log.hpp:43
static std::string logHeaderMessage
First caracters present for each logging message.
Definition: log.hpp:69
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy