mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-12 11:15:12 +00:00
Merge remote-tracking branch 'origin/feat/logs' into ConnectPro_v1.2
This commit is contained in:
@@ -20,9 +20,9 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
|
||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.12.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.13.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<None Remove="Properties\ControlSystem.cfg" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Data.SQLite" Version="2.2.1" />
|
||||
<PackageReference Include="Microsoft.Data.SQLite" Version="2.2.3" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="2.1.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||
<PackageReference Include="System.Net.NetworkInformation" Version="4.3.0" />
|
||||
|
||||
@@ -17,5 +17,10 @@ namespace ICD.Common.Utils.IO
|
||||
public IcdStreamWriter(StreamWriter baseStreamWriter) : base(baseStreamWriter)
|
||||
{
|
||||
}
|
||||
|
||||
public void WriteLine(string value)
|
||||
{
|
||||
WrappedStreamWriter.WriteLine(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using ICD.Common.Properties;
|
||||
using ICD.Common.Utils.Extensions;
|
||||
@@ -61,10 +62,24 @@ namespace ICD.Common.Utils
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IcdEnvironment.RuntimeEnvironment == IcdEnvironment.eRuntimeEnvironment.SimplSharpProMono)
|
||||
return Join(RootConfigPath, "ProgramConfig");
|
||||
string directoryName;
|
||||
|
||||
switch (IcdEnvironment.RuntimeEnvironment)
|
||||
{
|
||||
case IcdEnvironment.eRuntimeEnvironment.SimplSharp:
|
||||
case IcdEnvironment.eRuntimeEnvironment.SimplSharpPro:
|
||||
case IcdEnvironment.eRuntimeEnvironment.Standard:
|
||||
directoryName = string.Format("Program{0:D2}Config", ProgramUtils.ProgramNumber);
|
||||
break;
|
||||
|
||||
case IcdEnvironment.eRuntimeEnvironment.SimplSharpProMono:
|
||||
directoryName = "ProgramConfig";
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
string directoryName = string.Format("Program{0:D2}Config", ProgramUtils.ProgramNumber);
|
||||
return Join(RootConfigPath, directoryName);
|
||||
}
|
||||
}
|
||||
@@ -87,6 +102,37 @@ namespace ICD.Common.Utils
|
||||
[PublicAPI]
|
||||
public static string ProgramLibPath { get { return Join(ProgramConfigPath, "Lib"); } }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the absolute path to the logs directory.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[PublicAPI]
|
||||
public static string ProgramLogsPath
|
||||
{
|
||||
get
|
||||
{
|
||||
string directoryName;
|
||||
|
||||
switch (IcdEnvironment.RuntimeEnvironment)
|
||||
{
|
||||
case IcdEnvironment.eRuntimeEnvironment.SimplSharp:
|
||||
case IcdEnvironment.eRuntimeEnvironment.SimplSharpPro:
|
||||
case IcdEnvironment.eRuntimeEnvironment.Standard:
|
||||
directoryName = string.Format("Program{0:D2}Logs", ProgramUtils.ProgramNumber);
|
||||
break;
|
||||
|
||||
case IcdEnvironment.eRuntimeEnvironment.SimplSharpProMono:
|
||||
directoryName = "ProgramLogs";
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
return Join(RootConfigPath, directoryName);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using ICD.Common.Properties;
|
||||
|
||||
namespace ICD.Common.Utils.Services.Logging
|
||||
@@ -21,11 +20,6 @@ namespace ICD.Common.Utils.Services.Logging
|
||||
[PublicAPI]
|
||||
public DateTime Timestamp { get { return m_Timestamp; } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the log time in local time.
|
||||
/// </summary>
|
||||
public DateTime LocalTimestamp { get { return Timestamp.ToLocalTime(); } }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set for severity level.
|
||||
/// </summary>
|
||||
@@ -56,24 +50,6 @@ namespace ICD.Common.Utils.Services.Logging
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Return the text format to send to Fusion
|
||||
/// </summary>
|
||||
/// <returns>text format for fusion, including timestamp, severity, and message</returns>
|
||||
[PublicAPI]
|
||||
public string GetFusionLogText()
|
||||
{
|
||||
StringBuilder s = new StringBuilder();
|
||||
|
||||
s.Append(Timestamp.ToString("yyyyMMddHHmmss"));
|
||||
s.Append("||");
|
||||
s.Append((int)Severity);
|
||||
s.Append("||");
|
||||
s.Append(Message);
|
||||
|
||||
return s.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implementing default equality.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user