Esempio n. 1
0
        /// <summary>
        /// Associates a message with this job.
        /// </summary>
        /// <param name="level">The log level with which to associate the message.</param>
        /// <param name="format">The message format to associate with the job.</param>
        /// <param name="args">The message args to associate with the job.</param>
        protected internal void AddMessage(JobMessageLevel level, string format, params object[] args)
        {
            // TODO: Make Job Message expiry configurable via the settings db.
            var message = string.Format(CultureInfo.CurrentCulture, format, args);

            Console.WriteLine(message, args);
            this.Messages.Add(message);
            this.JobRepository.AddMessageToJob(this.JobSpec, level, message);
        }
Esempio n. 2
0
        /// <summary>
        /// Associates a message with this job.
        /// </summary>
        /// <param name="level">The log level with which to associate the message.</param>
        /// <param name="format">The message format to associate with the job.</param>
        /// <param name="args">The message args to associate with the job.</param>
        protected internal void AddMessage(JobMessageLevel level, string format, params object[] args)
        {
            // TODO: Make Job Message expirary configurable via the settings db.
            var message = string.Format(CultureInfo.CurrentCulture, format, args);

            Console.WriteLine(message, args);
            this.Messages.Add(message);
            this.messageCollection.InsertOneAsync(new JobMessage
            {
                JobUuid       = this.JobSpec.Uuid,
                MasterJobUuid = this.JobSpec.MasterUuid,
                ExpireAt      = DateTime.Now.AddDays(3),
                Timestamp     = DateTime.Now,
                Level         = (ushort)level,
                Message       = message
            });
        }
Esempio n. 3
0
 /// <summary>
 /// Adds a message to the associated job at the specified level.
 /// </summary>
 /// <param name="jobSpec">The job spec.</param>
 /// <param name="level">The message level.</param>
 /// <param name="message">The message.</param>
 public void AddMessageToJob(JobSpecLite jobSpec, JobMessageLevel level, string message)
 {
     JobMessageRepository.InternalAddMessageToJob(this.DbFactory, jobSpec, level, message);
 }
Esempio n. 4
0
        internal static void InternalAddMessageToJob(IDbFactory dbFactory, JobSpecLite jobSpec, JobMessageLevel level, string message)
        {
            // TODO: Make Job Message expiry configurable via the settings db.
            var expiry            = DateTime.Now.AddDays(3);
            var messageCollection = dbFactory.GetCollection <JobMessage>(CollectionNames.JobMessages);

            messageCollection.InsertOneAsync(new JobMessage
            {
                JobUuid       = jobSpec.Uuid,
                MasterJobUuid = jobSpec.MasterUuid,
                ExpireAt      = expiry,
                Timestamp     = DateTime.Now,
                Level         = (ushort)level,
                Message       = message
            });
        }