public static Boolean LogMessage(Int64 userID, String message, String messageType) { Boolean logSuccessful = false; Guid logSourceID = Guid.NewGuid(); String logSourceString = logSourceID.ToString(); AgileWays.Cqrs.Commands.Logging.LogCommand theLog = new AgileWays.Cqrs.Commands.Logging.LogCommand() { LogSourceID = logSourceID, Message = message, UserID = userID, MessageType = messageType, LogTime = DateTime.Now }; if (AddObjectToBlobStorage(logSourceString, "logitems", theLog)) { System.Diagnostics.Trace.TraceInformation("Added message from {0} to blob storage as {1}", userID.ToString(), logSourceID); if (AddMessageToQueue(logSourceString, "logmessages")) { System.Diagnostics.Trace.TraceInformation("Added {0} to queue", logSourceID); logSuccessful = true; } } return(logSuccessful); }
private static void WriteLogToStorage(string myMessage, AgileWays.Cqrs.Commands.Logging.LogCommand theLog) { Trace.TraceInformation("Message text {0}, sent {1} from user {2} on queue id {3}", theLog.Message, theLog.LogTime.ToString(), theLog.UserID.ToString(), myMessage); AgileWays.Repository.Logging.LogEntry log = new AgileWays.Repository.Logging.LogEntry(theLog.UserID) { LogDate = theLog.LogTime, Message = theLog.Message, MessageType = theLog.MessageType }; AgileWays.Repository.Logging.LogEntryDataSource data = new AgileWays.Repository.Logging.LogEntryDataSource(); data.AddLogEntry(log); }