diff --git a/src/Logging.Tests/Properties/AssemblyInfo.cs b/src/Logging.Tests/Properties/AssemblyInfo.cs index 729495e25772ea612907b4907ef0e5070cf82124..614bf73569cfcebfd930c39994b93706235991b4 100644 --- a/src/Logging.Tests/Properties/AssemblyInfo.cs +++ b/src/Logging.Tests/Properties/AssemblyInfo.cs @@ -9,8 +9,8 @@ using System.Reflection; [assembly: AssemblyDescription("Logging.Tests is a part of the CoScInE group.")] [assembly: AssemblyCompany("IT Center, RWTH Aachen University")] [assembly: AssemblyProduct("Logging.Tests")] -[assembly: AssemblyVersion("1.1.0")] -[assembly: AssemblyFileVersion("1.1.0")] -[assembly: AssemblyInformationalVersion("1.1.0-topic-671-readab0009")] +[assembly: AssemblyVersion("1.2.0")] +[assembly: AssemblyFileVersion("1.2.0")] +[assembly: AssemblyInformationalVersion("1.2.0-beta0003")] [assembly: AssemblyCopyright("2020 IT Center, RWTH Aachen University")] diff --git a/src/Logging/AnalyticsLogObject.cs b/src/Logging/AnalyticsLogObject.cs index dae2b44d0936b26fe5d0f9c35d972f61bf78a27c..6f30f5d2c162614c5eea98a9349863cf05f21d4a 100644 --- a/src/Logging/AnalyticsLogObject.cs +++ b/src/Logging/AnalyticsLogObject.cs @@ -10,38 +10,282 @@ namespace Coscine.Logging [Serializable] public class AnalyticsLogObject { - public string Type { get; set; } + private string _type = ""; + public string Type { + get + { + return _type; + } + set + { + if (value == null) + { + _type = ""; + } + else + { + _type = value; + } + } + } + + private string _operation = ""; - public string Operation { get; set; } + public string Operation { + get + { + return _operation; + } + set + { + if (value == null) + { + _operation = ""; + } + else + { + _operation = value; + } + } + } // Default is the current time - public DateTime Timestamp { get; set; } = DateTime.UtcNow; + private string _timestamp = FormatTimestamp(DateTime.UtcNow); + + public string Timestamp + { + get + { + return _timestamp; + } + set + { + if (value == null) + { + _timestamp = FormatTimestamp(DateTime.UtcNow); + } + else + { + _timestamp = value; + } + } + } + + private string _userId = ""; + + public string UserId + { + get + { + return _userId; + } + set + { + if (value == null) + { + _userId = ""; + } + else + { + _userId = value; + } + } + } - public string UserId { get; set; } + private string _roleId = ""; - public string RoleId { get; set; } + public string RoleId + { + get + { + return _roleId; + } + set + { + if (value == null) + { + _roleId = ""; + } + else + { + _roleId = value; + } + } + } - public string SessionId { get; set; } + private string _sessionId = ""; - public string ClientCorrolationId { get; set; } + public string SessionId + { + get + { + return _sessionId; + } + set + { + if (value == null) + { + _sessionId = ""; + } + else + { + _sessionId = value; + } + } + } - public string ProjectId { get; set; } + private string _clientCorrolationId = ""; - public string ResourceId { get; set; } + public string ClientCorrolationId + { + get + { + return _clientCorrolationId; + } + set + { + if (value == null) + { + _clientCorrolationId = ""; + } + else + { + _clientCorrolationId = value; + } + } + } - public string FileId { get; set; } + private string _projectId = ""; - public List<string> ProjectList { get; set; } + public string ProjectId + { + get + { + return _projectId; + } + set + { + if (value == null) + { + _projectId = ""; + } + else + { + _projectId = value; + } + } + } - public List<string> ResourceList { get; set; } + private string _resourceId = ""; - public List<string> UserList { get; set; } + public string ResourceId + { + get + { + return _resourceId; + } + set + { + if (value == null) + { + _resourceId = ""; + } + else + { + _resourceId = value; + } + } + } + + private string _fileId = ""; + + public string FileId + { + get + { + return _fileId; + } + set + { + if (value == null) + { + _fileId = ""; + } + else + { + _fileId = value; + } + } + } + + private List<string> _projectList = new List<string>(); + + public List<string> ProjectList + { + get + { + return _projectList; + } + set + { + if (value == null) + { + _projectList = new List<string>(); + } + else + { + _projectList = value; + } + } + } + + private List<string> _resourceList = new List<string>(); + + public List<string> ResourceList + { + get + { + return _resourceList; + } + set + { + if (value == null) + { + _resourceList = new List<string>(); + } + else + { + _resourceList = value; + } + } + } + + private List<string> _userList = new List<string>(); + + public List<string> UserList + { + get + { + return _userList; + } + set + { + if (value == null) + { + _userList = new List<string>(); + } + else + { + _userList = value; + } + } + } public AnalyticsLogObject (string type, string operation, DateTime timestamp, string userId, string roleId, string sessionId, string clientCorrolationId, string projectId, string resourceId, string fileId, List<string> projectList, List<string> resourceList, List<string> userList) { Type = type; Operation = operation; - Timestamp = timestamp; + Timestamp = FormatTimestamp(timestamp); UserId = userId; RoleId = roleId; SessionId = sessionId; @@ -57,5 +301,11 @@ namespace Coscine.Logging public AnalyticsLogObject() { } + + private static string FormatTimestamp(DateTime timestamp) + { + string formattedDateTime = String.Format("{0:yyyy-MM-dd hh:mm:ss.fff}", timestamp); + return formattedDateTime; + } } } diff --git a/src/Logging/Properties/AssemblyInfo.cs b/src/Logging/Properties/AssemblyInfo.cs index d0b2af41fb94c7a5728f0032b4bcd0799db370b5..ca631cedc5992c8cf933175a63c66e41db5380ef 100644 --- a/src/Logging/Properties/AssemblyInfo.cs +++ b/src/Logging/Properties/AssemblyInfo.cs @@ -9,8 +9,8 @@ using System.Reflection; [assembly: AssemblyDescription("Logging is a part of the CoScInE group.")] [assembly: AssemblyCompany("IT Center, RWTH Aachen University")] [assembly: AssemblyProduct("Logging")] -[assembly: AssemblyVersion("1.1.0")] -[assembly: AssemblyFileVersion("1.1.0")] -[assembly: AssemblyInformationalVersion("1.1.0-topic-671-readab0009")] +[assembly: AssemblyVersion("1.2.0")] +[assembly: AssemblyFileVersion("1.2.0")] +[assembly: AssemblyInformationalVersion("1.2.0-beta0003")] [assembly: AssemblyCopyright("2020 IT Center, RWTH Aachen University")]