private static void LogToDatabase(VirtualPrinterJobInfo jobInfo) { try { VirtualPrinterJobLog logger = new VirtualPrinterJobLog(jobInfo); _dataLogger.Submit(logger); } catch (Exception ex) { TraceFactory.Logger.Error("Error posting data to the STF data log service.", ex); } }
private static void DeviceHost_JobReceived(object sender, VirtualPrinterJobInfoEventArgs e) { try { VirtualPrinterJobInfo jobInfo = e.Job; if (_dataLogger != null) { // If we don't have the job name, there isn't enough data to log this print job if (!string.IsNullOrEmpty(jobInfo.PjlHeader.JobName)) { LogToDatabase(jobInfo); TraceFactory.Logger.Debug(GetString(jobInfo.PjlHeader)); return; } //If we get to this point, there was no job name. Continue on to log the data. TraceFactory.Logger.Debug("Insufficient data to log print job."); } } catch (Exception ex) { TraceFactory.Logger.Error("Unable to process print job.", ex); } }