@Override public String toString() { return getSystemString(); }
@Override public void log(String message) { Tasks.LOG.INFO(ctx.getSystemString() + ": " + message); }
@Override public void trace(String message) { if (Tasks.LOG.isFINE()) { Tasks.LOG.FINE(ctx.getSystemString() + ": " + message); } }
/** * Sets the <tt>Sub-System</tt> component of the <tt>System String</tt> * * @param subSystem the new sub system component to set * @return the task context itself for fluent method calls * @see #getSystemString() */ public TaskContext setSubSystem(String subSystem) { if (Strings.isEmpty(subSystem)) { this.subSystem = GENERIC; } else { this.subSystem = subSystem; } parent.addToMDC(MDC_SYSTEM, getSystemString()); return this; }
/** * Sets the <tt>System</tt> component of the <tt>System String</tt> * * @param system the new system component to set * @return the task context itself for fluent method calls * @see #getSystemString() */ public TaskContext setSystem(String system) { if (Strings.isEmpty(system)) { this.system = GENERIC; } else { this.system = system; } parent.addToMDC(MDC_SYSTEM, getSystemString()); return this; }
/** * Sets the <tt>Job</tt> component of the <tt>System String</tt> * * @param job the new job component to set * @return the task context itself for fluent method calls * @see #getSystemString() */ public TaskContext setJob(String job) { if (Strings.isEmpty(job)) { this.job = GENERIC; } else { this.job = job; } parent.addToMDC(MDC_SYSTEM, getSystemString()); return this; }
/** * Writes a log message to the monitor. * <p> * If no monitor is available, the <tt>async</tt> logger will be used. * * @param message the message to log * @param args the parameters used to format the message (see {@link Strings#apply(String, Object...)}) */ public void log(String message, Object... args) { if (adapter != null) { adapter.log(Strings.apply(message, args)); } else { Tasks.LOG.INFO(getSystemString() + ": " + Strings.apply(message, args)); } }