Skip to content
Snippets Groups Projects
Commit 9bde0774 authored by Marcel Nellesen's avatar Marcel Nellesen
Browse files

Update: Change timestamp format (coscine/issues#774)

parent 97dea427
No related branches found
No related tags found
No related merge requests found
...@@ -9,8 +9,8 @@ using System.Reflection; ...@@ -9,8 +9,8 @@ using System.Reflection;
[assembly: AssemblyDescription("Logging.Tests is a part of the CoScInE group.")] [assembly: AssemblyDescription("Logging.Tests is a part of the CoScInE group.")]
[assembly: AssemblyCompany("IT Center, RWTH Aachen University")] [assembly: AssemblyCompany("IT Center, RWTH Aachen University")]
[assembly: AssemblyProduct("Logging.Tests")] [assembly: AssemblyProduct("Logging.Tests")]
[assembly: AssemblyVersion("1.1.0")] [assembly: AssemblyVersion("1.2.0")]
[assembly: AssemblyFileVersion("1.1.0")] [assembly: AssemblyFileVersion("1.2.0")]
[assembly: AssemblyInformationalVersion("1.1.0-topic-671-readab0009")] [assembly: AssemblyInformationalVersion("1.2.0-beta0003")]
[assembly: AssemblyCopyright("2020 IT Center, RWTH Aachen University")] [assembly: AssemblyCopyright("2020 IT Center, RWTH Aachen University")]
...@@ -10,38 +10,282 @@ namespace Coscine.Logging ...@@ -10,38 +10,282 @@ namespace Coscine.Logging
[Serializable] [Serializable]
public class AnalyticsLogObject 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;
}
}
}
public string Operation { get; set; } private string _operation = "";
public string Operation {
get
{
return _operation;
}
set
{
if (value == null)
{
_operation = "";
}
else
{
_operation = value;
}
}
}
// Default is the current time // Default is the current time
public DateTime Timestamp { get; set; } = DateTime.UtcNow; private string _timestamp = FormatTimestamp(DateTime.UtcNow);
public string UserId { get; set; } public string Timestamp
{
get
{
return _timestamp;
}
set
{
if (value == null)
{
_timestamp = FormatTimestamp(DateTime.UtcNow);
}
else
{
_timestamp = value;
}
}
}
public string RoleId { get; set; } private string _userId = "";
public string SessionId { get; set; } public string UserId
{
get
{
return _userId;
}
set
{
if (value == null)
{
_userId = "";
}
else
{
_userId = value;
}
}
}
public string ClientCorrolationId { get; set; } private string _roleId = "";
public string ProjectId { get; set; } public string RoleId
{
get
{
return _roleId;
}
set
{
if (value == null)
{
_roleId = "";
}
else
{
_roleId = value;
}
}
}
public string ResourceId { get; set; } private string _sessionId = "";
public string FileId { get; set; } public string SessionId
{
get
{
return _sessionId;
}
set
{
if (value == null)
{
_sessionId = "";
}
else
{
_sessionId = value;
}
}
}
public List<string> ProjectList { get; set; } private string _clientCorrolationId = "";
public List<string> ResourceList { get; set; } public string ClientCorrolationId
{
get
{
return _clientCorrolationId;
}
set
{
if (value == null)
{
_clientCorrolationId = "";
}
else
{
_clientCorrolationId = value;
}
}
}
public List<string> UserList { get; set; } private string _projectId = "";
public string ProjectId
{
get
{
return _projectId;
}
set
{
if (value == null)
{
_projectId = "";
}
else
{
_projectId = value;
}
}
}
private string _resourceId = "";
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) 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; Type = type;
Operation = operation; Operation = operation;
Timestamp = timestamp; Timestamp = FormatTimestamp(timestamp);
UserId = userId; UserId = userId;
RoleId = roleId; RoleId = roleId;
SessionId = sessionId; SessionId = sessionId;
...@@ -57,5 +301,11 @@ namespace Coscine.Logging ...@@ -57,5 +301,11 @@ namespace Coscine.Logging
public AnalyticsLogObject() public AnalyticsLogObject()
{ {
} }
private static string FormatTimestamp(DateTime timestamp)
{
string formattedDateTime = String.Format("{0:yyyy-MM-dd hh:mm:ss.fff}", timestamp);
return formattedDateTime;
}
} }
} }
...@@ -9,8 +9,8 @@ using System.Reflection; ...@@ -9,8 +9,8 @@ using System.Reflection;
[assembly: AssemblyDescription("Logging is a part of the CoScInE group.")] [assembly: AssemblyDescription("Logging is a part of the CoScInE group.")]
[assembly: AssemblyCompany("IT Center, RWTH Aachen University")] [assembly: AssemblyCompany("IT Center, RWTH Aachen University")]
[assembly: AssemblyProduct("Logging")] [assembly: AssemblyProduct("Logging")]
[assembly: AssemblyVersion("1.1.0")] [assembly: AssemblyVersion("1.2.0")]
[assembly: AssemblyFileVersion("1.1.0")] [assembly: AssemblyFileVersion("1.2.0")]
[assembly: AssemblyInformationalVersion("1.1.0-topic-671-readab0009")] [assembly: AssemblyInformationalVersion("1.2.0-beta0003")]
[assembly: AssemblyCopyright("2020 IT Center, RWTH Aachen University")] [assembly: AssemblyCopyright("2020 IT Center, RWTH Aachen University")]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment