/// <summary> /// Logs the progress of a job, given as a number of completed tasks /// out of a total number of tasks. /// </summary> /// <param name="jobName">Name of the job.</param> /// <param name="processName">Name of the process associated with the job.</param> /// <param name="total">The total number of tasks.</param> /// <param name="completed">The completed number of tasks.</param> public void logJobProgress(String jobName, String processName, int total, int completed) { Category category = Category.PROGRESS; Priority priority = GlobVar.DEFAULT_PRIORITY; ProcessWrapper proc = new ProcessWrapper(processName); JobWrapper job = new JobWrapper(jobName); String message = processName + ", " + jobName + ": " + completed.ToString() + " of " + total.ToString() + " job tasks completed"; job.Update(total, completed); MessageWrapper mess = new MessageWrapper(message, category, priority); LogRelWrapper rel = new LogRelWrapper(mess.MessageId, proc.ProcessId, job.JobId); }
/// <summary> /// Logs the completion of a job. /// </summary> /// <param name="jobName">Name of the job.</param> /// <param name="processName">Name of the process associated with the job.</param> public void logJobComplete(String jobName, String processName) { Category category = Category.PROGRESS; Priority priority = GlobVar.DEFAULT_PRIORITY; double percent = 100.0; ProcessWrapper proc = new ProcessWrapper(processName); JobWrapper job = new JobWrapper(jobName); String message = processName + ", " + jobName + ": Job Completed"; job.Update(percent); MessageWrapper mess = new MessageWrapper(message, category, priority); LogRelWrapper rel = new LogRelWrapper(mess.MessageId, proc.ProcessId, job.JobId); }
/// <summary> /// Logs the change of a process' state. /// </summary> /// <param name="processName">Name of the process.</param> /// <param name="state">The process state.</param> public void logProcessStateChange(String processName, ProcessState state) { Category category = Category.STATE_CHANGE; Priority priority = GlobVar.DEFAULT_PRIORITY; ProcessWrapper proc = new ProcessWrapper(processName); String message = processName + ": Process state changed from " + ProcessStateToString(proc.State) + " to " + ProcessStateToString(state); proc.Update(state); MessageWrapper mess = new MessageWrapper(message, category, priority); LogRelWrapper rel = new LogRelWrapper(mess.MessageId, proc.ProcessId); }
/// <summary> /// Logs the starting of a process. /// </summary> /// <param name="processName">Name of the process.</param> public void logProcessStart(String processName) { Category category = Category.START; Priority priority = GlobVar.DEFAULT_PRIORITY; ProcessState startState = GlobVar.DEFAULT_PROCESS_STATE; ProcessWrapper proc = new ProcessWrapper(processName); String message = processName + ": Process Started"; // Reset state, just in case the process is already in the database. proc.Update(startState); MessageWrapper mess = new MessageWrapper(message, category, priority); LogRelWrapper rel = new LogRelWrapper(mess.MessageId, proc.ProcessId); }
/// <summary> /// Logs the shutdown of a process. /// </summary> /// <param name="processName">Name of the process.</param> public void logProcessShutdown(String processName) { Category category = Category.STOP; Priority priority = GlobVar.DEFAULT_PRIORITY; ProcessWrapper proc = new ProcessWrapper(processName); String message = processName + ": Process shut down"; MessageWrapper mess = new MessageWrapper(message, category, priority); LogRelWrapper rel = new LogRelWrapper(mess.MessageId, proc.ProcessId); }
/// <summary> /// Logs a message for a given process. /// </summary> /// <param name="processName">Name of the process.</param> /// <param name="message">The message text.</param> /// <param name="category">The message category.</param> /// <param name="priority">The message priority.</param> public void logProcessMessage(String processName, String message, Category category, Priority priority) { message = processName + ": " + message; ProcessWrapper proc = new ProcessWrapper(processName); MessageWrapper mess = new MessageWrapper(message, category, priority); LogRelWrapper rel = new LogRelWrapper(mess.MessageId, proc.ProcessId); }
/// <summary> /// Logs the start of a job with a given number of total tasks. /// </summary> /// <param name="jobName">Name of the job.</param> /// <param name="processName">Name of the process associated with the job.</param> /// <param name="totalTasks">The number of total tasks for this job.</param> public void logJobStartWithTotalTasks(String jobName, String processName, int totalTasks) { Category category = Category.PROGRESS; Priority priority = GlobVar.DEFAULT_PRIORITY; int completed = 0; ProcessWrapper proc = new ProcessWrapper(processName); JobWrapper job = new JobWrapper(jobName); String message = processName + ", " + jobName + ": Job started with " + totalTasks.ToString() + " total tasks"; job.Update(totalTasks, completed); MessageWrapper mess = new MessageWrapper(message, category, priority); LogRelWrapper rel = new LogRelWrapper(mess.MessageId, proc.ProcessId, job.JobId); }
/// <summary> /// Logs the starting of a job. /// </summary> /// <param name="jobName">Name of the job.</param> /// <param name="processName">Name of the process associated with the job.</param> public void logJobStart(String jobName, String processName) { Category category = Category.PROGRESS; Priority priority = GlobVar.DEFAULT_PRIORITY; ProcessWrapper proc = new ProcessWrapper(processName); JobWrapper job = new JobWrapper(jobName); String message = processName + ", " + jobName + ": Job started"; // Reset progress, just in case the job is already in the database. job.Update(GlobVar.DEFAULT_PLANNED_COUNT, GlobVar.DEFAULT_COMPLETED_COUNT); MessageWrapper mess = new MessageWrapper(message, category, priority); LogRelWrapper rel = new LogRelWrapper(mess.MessageId, proc.ProcessId, job.JobId); }