]> git.sesse.net Git - casparcg/blobdiff - common/log.h
Qualify buffer::usage enum
[casparcg] / common / log.h
index 441837116dff836e5ef37be480059117344bc960..3deb67f2f4257ebc5d968e5951477717933156f0 100644 (file)
@@ -32,6 +32,8 @@
 
 #include <string>
 #include <locale>
+#include <functional>
+#include <memory>
 
 namespace caspar { namespace log {
        
@@ -61,6 +63,7 @@ inline std::basic_string<T> replace_nonprintable_copy(std::basic_string<T, std::
 }
 
 void add_file_sink(const std::wstring& folder);
+std::shared_ptr<void> add_preformatted_line_sink(std::function<void(std::string line)> formatted_line_sink);
 
 typedef boost::log::sources::wseverity_logger_mt<boost::log::trivial::severity_level> caspar_logger;
 
@@ -79,10 +82,15 @@ BOOST_LOG_INLINE_GLOBAL_LOGGER_INIT(logger, caspar_logger)
        catch(...){}
 
 #define CASPAR_LOG_CURRENT_EXCEPTION() try{\
-               CASPAR_LOG(error)  << caspar::u16(boost::current_exception_diagnostic_information()) << L"Caught at (" << caspar::get_thread_info().name << L"):\n" << caspar::get_call_stack();\
+               CASPAR_LOG(error) << caspar::u16(boost::current_exception_diagnostic_information()) << L"Caught at (" << caspar::get_thread_info().name << L"):\n" << caspar::get_call_stack();\
        }\
        catch(...){}
-       
+
+#define CASPAR_LOG_CURRENT_EXCEPTION_AT_LEVEL(lvl) try{\
+               CASPAR_LOG(lvl) << caspar::u16(boost::current_exception_diagnostic_information()) << L"Caught at (" << caspar::get_thread_info().name << L"):\n" << caspar::get_call_stack();\
+       }\
+       catch(...){}
+
 void set_log_level(const std::wstring& lvl);
 
 void print_child(