Rely on Config for log settings, not the command line.
authorCarl Hetherington <cth@carlh.net>
Sat, 24 May 2014 21:47:29 +0000 (22:47 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 24 May 2014 21:47:29 +0000 (22:47 +0100)
ChangeLog
src/lib/log.cc
src/lib/log.h
src/tools/dcpomatic.cc
src/tools/dcpomatic_cli.cc

index 59999b8617d72d86fe69407e14d01568980ad536..ad14f7b07bf562adc10b4ae421a0d8b28b9498c7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-05-24  Carl Hetherington  <cth@carlh.net>
+
+       * Fix problems with log setup from config.
+
 2014-05-23  Carl Hetherington  <cth@carlh.net>
 
        * Version 1.69.12 released.
index a2f420ce1b0b8211f0cd3d6e23d759a00c477afc..52dff2982222620d81a9b7426c13c2a32beb523e 100644 (file)
@@ -23,7 +23,6 @@
 
 #include <time.h>
 #include <cstdio>
-#include <boost/algorithm/string.hpp>
 #include "log.h"
 #include "cross.h"
 #include "config.h"
@@ -31,8 +30,6 @@
 #include "i18n.h"
 
 using namespace std;
-using boost::algorithm::is_any_of;
-using boost::algorithm::split;
 
 int const Log::TYPE_GENERAL = 0x1;
 int const Log::TYPE_WARNING = 0x2;
@@ -105,30 +102,6 @@ Log::set_types (int t)
        _types = t;
 }
 
-/** @param A comma-separate list of debug types to enable */
-void
-Log::set_types (string t)
-{
-       boost::mutex::scoped_lock lm (_mutex);
-
-       vector<string> types;
-       split (types, t, is_any_of (","));
-
-       _types = 0;
-
-       for (vector<string>::const_iterator i = types.begin(); i != types.end(); ++i) {
-               if (*i == N_("general")) {
-                       _types |= TYPE_GENERAL;
-               } else if (*i == N_("warning")) {
-                       _types |= TYPE_WARNING;
-               } else if (*i == N_("error")) {
-                       _types |= TYPE_ERROR;
-               } else if (*i == N_("timing")) {
-                       _types |= TYPE_TIMING;
-               }
-       }
-}
-
 /** @param file Filename to write log to */
 FileLog::FileLog (boost::filesystem::path file)
        : _file (file)
index c11daf61708f23d9b0578cad8062e8dd2d652b74..2ba273b44dd09e2e254c3a914ce16d2829959cee 100644 (file)
@@ -46,7 +46,6 @@ public:
        void microsecond_log (std::string message, int type);
 
        void set_types (int types);
-       void set_types (std::string types);
 
 protected:     
        /** mutex to protect the log */
index d092992a17a31c640141c3791c9ba3c33bc719d7..da994796eb0cc570090d5b7ab68a74c3089bfce9 100644 (file)
@@ -74,7 +74,6 @@ using boost::dynamic_pointer_cast;
 static FilmEditor* film_editor = 0;
 static FilmViewer* film_viewer = 0;
 static shared_ptr<Film> film;
-static std::string log_types = "general,log,warning";
 static std::string film_to_load;
 static std::string film_to_create;
 static std::string content_to_add;
@@ -157,7 +156,6 @@ load_film (boost::filesystem::path file)
        for (list<string>::const_iterator i = notes.begin(); i != notes.end(); ++i) {
                error_dialog (0, std_to_wx (*i));
        }
-       film->log()->set_types (log_types);
 }
 
 #define ALWAYS                  0x0
@@ -401,7 +399,6 @@ private:
                        maybe_save_then_delete_film ();
                        film.reset (new Film (d->get_path ()));
                        film->write_metadata ();
-                       film->log()->set_types (log_types);
                        film->set_name (boost::filesystem::path (d->get_path()).filename().generic_string());
                        set_film ();
                }
@@ -609,7 +606,6 @@ private:
 };
 
 static const wxCmdLineEntryDesc command_line_description[] = {
-       { wxCMD_LINE_OPTION, "l", "log", "set message types to log (general,warning,error,timing)", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
        { wxCMD_LINE_SWITCH, "n", "new", "create new film", wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL },
        { wxCMD_LINE_OPTION, "c", "content", "add content file", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
        { wxCMD_LINE_PARAM, 0, 0, "film to load or create", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
@@ -668,7 +664,6 @@ class App : public wxApp
                if (!film_to_create.empty ()) {
                        film.reset (new Film (film_to_create));
                        film->write_metadata ();
-                       film->log()->set_types (log_types);
                        film->set_name (boost::filesystem::path (film_to_create).filename().generic_string ());
                }
 
@@ -726,11 +721,6 @@ class App : public wxApp
                        content_to_add = wx_to_std (content);
                }
 
-               wxString log;
-               if (parser.Found (wxT ("log"), &log)) {
-                       log_types = wx_to_std (log);
-               }
-
                return true;
        }
 
index 73067f406d559996ee3255157b1315edde14b039..8fed28f18039217e82aa618e36e985f0d98f695e 100644 (file)
@@ -65,7 +65,6 @@ main (int argc, char* argv[])
        string film_dir;
        bool progress = true;
        bool no_remote = false;
-       string log_types = "general,warning,error";
        int json_port = 0;
        bool keep_going = false;
 
@@ -78,13 +77,12 @@ main (int argc, char* argv[])
                        { "flags", no_argument, 0, 'f'},
                        { "no-progress", no_argument, 0, 'n'},
                        { "no-remote", no_argument, 0, 'r'},
-                       { "log-types", required_argument, 0, 'l' },
                        { "json", required_argument, 0, 'j' },
                        { "keep-going", no_argument, 0, 'k' },
                        { 0, 0, 0, 0 }
                };
 
-               int c = getopt_long (argc, argv, "vhdfnrl:j:k", long_options, &option_index);
+               int c = getopt_long (argc, argv, "vhdfnrj:k", long_options, &option_index);
 
                if (c == -1) {
                        break;
@@ -109,9 +107,6 @@ main (int argc, char* argv[])
                case 'r':
                        no_remote = true;
                        break;
-               case 'l':
-                       log_types = optarg;
-                       break;
                case 'j':
                        json_port = atoi (optarg);
                        break;
@@ -155,8 +150,6 @@ main (int argc, char* argv[])
                exit (EXIT_FAILURE);
        }
 
-       film->log()->set_types (log_types);
-
        cout << "\nMaking DCP for " << film->name() << "\n";
 //     cout << "Content: " << film->content() << "\n";
 //     pair<string, string> const f = Filter::ffmpeg_strings (film->filters ());