internal static void DispatcherActivity(this Logger log, DispatcherId dispatcherId, DispatcherActivity activity, PoisonPill poisonPill = null, Exception exception = null, bool logAsError = true)
        {
            var logEntry = new DispatcherActivityLogEntry
            {
                DispatcherId = dispatcherId,
                Activity = activity,
                PoisonPill = poisonPill,
                Exception = exception
            };

            if (exception == null)
            {
                if (activity == Dispatching.DispatcherActivity.CheckingForUnfinishedJobs)
                    log.Debug(logEntry);
                else
                    log.Info(logEntry);
            }
            else if (logAsError)
                log.Error(exception, logEntry.ToString());
            else
                log.Info(exception, logEntry.ToString());
        }
        internal static void DispatcherActivity(this Logger log, DispatcherId dispatcherId, DispatcherActivity activity, Job job, JobStatus oldStatus, JobStatus? newStatus = null)
        {
            var logEntry = new DispatcherActivityLogEntry
            {
                DispatcherId = dispatcherId,
                Activity = activity,
                Job = job,
                OldStatus = oldStatus,
                NewStatus = newStatus ?? oldStatus
            };

            log.Info(logEntry);
        }