mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Save application and system information in the log file under all commands not just dump.
This commit is contained in:
@@ -49,7 +49,6 @@
|
||||
<ProjectReference Include="..\Aaru.Helpers\Aaru.Helpers.csproj"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Logging\"/>
|
||||
<Folder Include="Devices\"/>
|
||||
<Folder Include="Devices\Scanning\"/>
|
||||
<Folder Include="Devices\Dumping\"/>
|
||||
|
||||
@@ -32,13 +32,9 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using Aaru.CommonTypes.Interop;
|
||||
using Aaru.Devices;
|
||||
using Aaru.Logging;
|
||||
using PlatformID = Aaru.CommonTypes.Interop.PlatformID;
|
||||
using Version = Aaru.CommonTypes.Interop.Version;
|
||||
|
||||
namespace Aaru.Core.Logging;
|
||||
|
||||
@@ -50,39 +46,6 @@ public static class DumpLog
|
||||
/// <param name="private">Disable saving paths or serial numbers in log</param>
|
||||
public static void StartLog(Device dev, bool @private)
|
||||
{
|
||||
AaruLogging.Information(Localization.Core.Start_logging_at_0, DateTime.Now);
|
||||
|
||||
PlatformID platId = DetectOS.GetRealPlatformID();
|
||||
string platVer = DetectOS.GetVersion();
|
||||
|
||||
var assemblyVersion =
|
||||
Attribute.GetCustomAttribute(typeof(DumpLog).Assembly, typeof(AssemblyInformationalVersionAttribute)) as
|
||||
AssemblyInformationalVersionAttribute;
|
||||
|
||||
AaruLogging.Information(Localization.Core.System_information);
|
||||
|
||||
AaruLogging.Information("{0} {1} ({2}-bit)",
|
||||
DetectOS.GetPlatformName(platId, platVer),
|
||||
platVer,
|
||||
Environment.Is64BitOperatingSystem ? 64 : 32);
|
||||
|
||||
if(DetectOS.IsMono)
|
||||
AaruLogging.Information("Mono {0}", Version.GetMonoVersion());
|
||||
else if(DetectOS.IsNetCore)
|
||||
AaruLogging.Information(".NET Core {0}", Version.GetNetCoreVersion());
|
||||
else
|
||||
AaruLogging.Information(RuntimeInformation.FrameworkDescription);
|
||||
|
||||
AaruLogging.Information(Localization.Core.Program_information);
|
||||
AaruLogging.Information("Aaru {0}", assemblyVersion?.InformationalVersion);
|
||||
AaruLogging.Information(Localization.Core.Running_in_0_bit, Environment.Is64BitProcess ? 64 : 32);
|
||||
|
||||
AaruLogging.Information(DetectOS.IsAdmin
|
||||
? Localization.Core.Running_as_superuser_Yes
|
||||
: Localization.Core.Running_as_superuser_No);
|
||||
#if DEBUG
|
||||
AaruLogging.Information(Localization.Core.DEBUG_version);
|
||||
#endif
|
||||
if(@private)
|
||||
{
|
||||
string[] args = Environment.GetCommandLineArgs();
|
||||
|
||||
6
Aaru.Localization/Core.Designer.cs
generated
6
Aaru.Localization/Core.Designer.cs
generated
@@ -6868,5 +6868,11 @@ namespace Aaru.Localization {
|
||||
return ResourceManager.GetString("Blu_ray_type_BDR_setting_disc_type_BDR", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
public static string Running_in_0_architecture {
|
||||
get {
|
||||
return ResourceManager.GetString("Running_in_0_architecture", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3505,4 +3505,7 @@ It has no sense to do it, and it will put too much strain on the tape.</value>
|
||||
<data name="Blu_ray_type_BDR_setting_disc_type_BDR" xml:space="preserve">
|
||||
<value>Blu-ray type set to "BDR", setting disc type to BD-R.</value>
|
||||
</data>
|
||||
<data name="Running_in_0_architecture" xml:space="preserve">
|
||||
<value>Running in {0} architecture</value>
|
||||
</data>
|
||||
</root>
|
||||
6
Aaru.Localization/UI.Designer.cs
generated
6
Aaru.Localization/UI.Designer.cs
generated
@@ -6105,5 +6105,11 @@ namespace Aaru.Localization {
|
||||
return ResourceManager.GetString("Unable_to_get_separate_tracks_not_checksumming_them", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
public static string Running_in_0_architecture {
|
||||
get {
|
||||
return ResourceManager.GetString("Running_in_0_architecture", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3129,4 +3129,7 @@ Do you want to continue?</value>
|
||||
<data name="Unable_to_get_separate_tracks_not_checksumming_them" xml:space="preserve">
|
||||
<value>[yellow]Unable to get separate tracks, not checksumming them[/]</value>
|
||||
</data>
|
||||
<data name="Running_in_0_architecture" xml:space="preserve">
|
||||
<value>Running in {0} architecture</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,10 +1,16 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using Aaru.Commands;
|
||||
using Aaru.CommonTypes.Interop;
|
||||
using Aaru.Localization;
|
||||
using Serilog;
|
||||
using Serilog.Core;
|
||||
using Serilog.Events;
|
||||
using Serilog.Sinks.Spectre;
|
||||
using Spectre.Console;
|
||||
using Spectre.Console.Cli;
|
||||
using PlatformID = Aaru.CommonTypes.Interop.PlatformID;
|
||||
|
||||
public class LoggingInterceptor : ICommandInterceptor
|
||||
{
|
||||
@@ -47,8 +53,43 @@ public class LoggingInterceptor : ICommandInterceptor
|
||||
}
|
||||
|
||||
Log.Logger = loggerConfig.CreateLogger();
|
||||
Log.Information("Log level set to {Level}", _levelSwitch.MinimumLevel);
|
||||
if(global.LogFile != null) Log.Information("Logging to file: {Path}", global.LogFile);
|
||||
|
||||
if(global.LogFile == null) return;
|
||||
|
||||
Log.Information(Core.Start_logging_at_0, DateTime.Now);
|
||||
|
||||
PlatformID platId = DetectOS.GetRealPlatformID();
|
||||
string platVer = DetectOS.GetVersion();
|
||||
|
||||
var assemblyVersion =
|
||||
Attribute.GetCustomAttribute(typeof(LoggingInterceptor).Assembly,
|
||||
typeof(AssemblyInformationalVersionAttribute)) as
|
||||
AssemblyInformationalVersionAttribute;
|
||||
|
||||
Log.Information(Core.Program_information);
|
||||
Log.Information("Aaru Data Preservation Suite {InformationalVersion}", assemblyVersion?.InformationalVersion);
|
||||
Log.Information(Core.Running_in_0_architecture, RuntimeInformation.ProcessArchitecture);
|
||||
Log.Information(Core.Running_in_0_bit, Environment.Is64BitProcess ? 64 : 32);
|
||||
|
||||
Log.Information(DetectOS.IsAdmin ? Core.Running_as_superuser_Yes : Core.Running_as_superuser_No);
|
||||
#if DEBUG
|
||||
Log.Information(Core.DEBUG_version);
|
||||
#endif
|
||||
Log.Information(Core.Log_section_separator);
|
||||
Log.Information("");
|
||||
|
||||
Log.Information(Core.System_information);
|
||||
|
||||
Log.Information("{PlatformName} {PlatformVersion} ({ProcessorArchitecture} {Bittage}-bit)",
|
||||
DetectOS.GetPlatformName(platId, platVer),
|
||||
platVer,
|
||||
RuntimeInformation.OSArchitecture,
|
||||
Environment.Is64BitOperatingSystem ? 64 : 32);
|
||||
|
||||
Log.Information(RuntimeInformation.FrameworkDescription);
|
||||
Log.Information(Core.Log_section_separator);
|
||||
|
||||
Log.Information("");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -424,11 +424,5 @@ class MainClass
|
||||
|
||||
AnsiConsole.MarkupLine("[bold][blue]{0}[/][/]", _assemblyCopyright);
|
||||
AnsiConsole.WriteLine();
|
||||
|
||||
AaruLogging.Information("Aaru Data Preservation Suite {InformationalVersion}",
|
||||
_assemblyVersion?.InformationalVersion);
|
||||
|
||||
AaruLogging.Information("{AssemblyCopyright}", _assemblyCopyright);
|
||||
AaruLogging.Information("Logging started");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user