Fix truncated log timestamps in at least some cases.
[dcpomatic.git] / src / lib / job.cc
index 91581eb49550db343718606c5ede43ab249f6774..2c2e0667329c1c0ef435d036fd31c256d109000a 100644 (file)
@@ -42,7 +42,8 @@ using boost::shared_ptr;
 using boost::optional;
 using boost::function;
 
-#define LOG_ERROR_NC(...) _film->log()->log (__VA_ARGS__, Log::TYPE_ERROR);
+#define LOG_ERROR_NC(...) _film->log()->log (__VA_ARGS__, LogEntry::TYPE_ERROR);
+#define LOG_GENERAL(...) _film->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
 
 /** @param film Associated film, or 0 */
 Job::Job (shared_ptr<const Film> film)
@@ -106,7 +107,10 @@ Job::run_wrapper ()
 
                set_error (
                        String::compose (_("Could not open %1"), e.file().string()),
-                       String::compose (_("DCP-o-matic could not open the file %1.  Perhaps it does not exist or is in an unexpected format."), e.file().string())
+                       String::compose (
+                               _("DCP-o-matic could not open the file %1.  Perhaps it does not exist or is in an unexpected format."),
+                               boost::filesystem::absolute (e.file()).string()
+                               )
                        );
 
                set_progress (1);
@@ -117,7 +121,10 @@ Job::run_wrapper ()
                if (e.code() == boost::system::errc::no_such_file_or_directory) {
                        set_error (
                                String::compose (_("Could not open %1"), e.path1().string ()),
-                               String::compose (_("DCP-o-matic could not open the file %1.  Perhaps it does not exist or is in an unexpected format."), e.path1().string())
+                               String::compose (
+                                       _("DCP-o-matic could not open the file %1.  Perhaps it does not exist or is in an unexpected format."),
+                                       boost::filesystem::absolute (e.path1()).string()
+                                       )
                                );
                } else {
                        set_error (
@@ -295,6 +302,7 @@ Job::sub (string n)
 {
        {
                boost::mutex::scoped_lock lm (_progress_mutex);
+               LOG_GENERAL ("Sub-job %1 starting", n);
                _sub_name = n;
        }
 
@@ -322,12 +330,12 @@ Job::error_summary () const
 void
 Job::set_error (string s, string d)
 {
-       LOG_ERROR_NC (s);
-       LOG_ERROR_NC (d);
-
        if (_film) {
-               _film->log()->log (String::compose ("Error in job: %1 (%2)", s, d), Log::TYPE_ERROR);
+               LOG_ERROR_NC (s);
+               LOG_ERROR_NC (d);
+               _film->log()->log (String::compose ("Error in job: %1 (%2)", s, d), LogEntry::TYPE_ERROR);
        }
+
        boost::mutex::scoped_lock lm (_state_mutex);
        _error_summary = s;
        _error_details = d;