Tidy up logging a bit. Make it configurable from the GUI.
[dcpomatic.git] / src / lib / config.cc
index 40ae3971be9bd0ba5781bb9496bb7f9bf2f7b257..6d029dd1fa1e545f7ebf0d28bac9ed840737f310 100644 (file)
@@ -73,6 +73,7 @@ Config::Config ()
        , _check_for_updates (false)
        , _check_for_test_updates (false)
        , _maximum_j2k_bandwidth (250000000)
+       , _log_types (Log::GENERAL | Log::WARNING | Log::ERROR)
 {
        _allowed_dcp_frame_rates.push_back (24);
        _allowed_dcp_frame_rates.push_back (25);
@@ -189,6 +190,8 @@ Config::read ()
 
        _maximum_j2k_bandwidth = f.optional_number_child<int> ("MaximumJ2KBandwidth").get_value_or (250000000);
        _allow_any_dcp_frame_rate = f.optional_bool_child ("AllowAnyDCPFrameRate");
+
+       _log_types = f.optional_number_child<int> ("LogTypes").get_value_or (Log::GENERAL | Log::WARNING | Log::ERROR);
 }
 
 void
@@ -366,6 +369,7 @@ Config::write () const
 
        root->add_child("MaximumJ2KBandwidth")->add_child_text (raw_convert<string> (_maximum_j2k_bandwidth));
        root->add_child("AllowAnyDCPFrameRate")->add_child_text (_allow_any_dcp_frame_rate ? "1" : "0");
+       root->add_child("LogTypes")->add_child_text (raw_convert<string> (_log_types));
        
        doc.write_to_file_formatted (file(false).string ());
 }