mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-31 17:53:32 +00:00
Added button to open logs folder to settings
Render exceptions are logged instead of thrown Fixed layer condition crash Logs are now archived and kept for 7 days
This commit is contained in:
parent
2a13859afd
commit
08f8f45026
@ -62,16 +62,7 @@ namespace Artemis.Managers
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
if (_canShowException)
|
_logger.Warn(e, "Exception in render loop");
|
||||||
{
|
|
||||||
Execute.OnUIThread(delegate
|
|
||||||
{
|
|
||||||
_canShowException = false;
|
|
||||||
_loopTimer.Stop();
|
|
||||||
App.GetArtemisExceptionViewer(e).ShowDialog();
|
|
||||||
Environment.Exit(0);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -77,6 +77,8 @@ namespace Artemis.Models
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
lock (DataModel)
|
lock (DataModel)
|
||||||
|
{
|
||||||
|
lock (Profile)
|
||||||
{
|
{
|
||||||
// Get all enabled layers who's conditions are met
|
// Get all enabled layers who's conditions are met
|
||||||
var renderLayers = GetRenderLayers(keyboardOnly);
|
var renderLayers = GetRenderLayers(keyboardOnly);
|
||||||
@ -130,6 +132,7 @@ namespace Artemis.Models
|
|||||||
Logger.Trace("- Layer name: {0}, layer type: {1}", renderLayer.Name, renderLayer.LayerType);
|
Logger.Trace("- Layer name: {0}, layer type: {1}", renderLayer.Name, renderLayer.LayerType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public abstract List<LayerModel> GetRenderLayers(bool keyboardOnly);
|
public abstract List<LayerModel> GetRenderLayers(bool keyboardOnly);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,8 @@ namespace Artemis.Profiles.Layers.Models
|
|||||||
public string Type { get; set; }
|
public string Type { get; set; }
|
||||||
|
|
||||||
public bool ConditionMet(IDataModel subject)
|
public bool ConditionMet(IDataModel subject)
|
||||||
|
{
|
||||||
|
lock (subject)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(Field) || string.IsNullOrEmpty(Value) || string.IsNullOrEmpty(Type))
|
if (string.IsNullOrEmpty(Field) || string.IsNullOrEmpty(Value) || string.IsNullOrEmpty(Type))
|
||||||
return false;
|
return false;
|
||||||
@ -56,3 +58,4 @@ namespace Artemis.Profiles.Layers.Models
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@ -36,11 +36,13 @@ namespace Artemis.Utilities
|
|||||||
|
|
||||||
// Step 3. Set target properties
|
// Step 3. Set target properties
|
||||||
debuggerTarget.Layout = @"${logger:shortName=True} - ${uppercase:${level}}: ${message}";
|
debuggerTarget.Layout = @"${logger:shortName=True} - ${uppercase:${level}}: ${message}";
|
||||||
fileTarget.FileName = "${specialfolder:folder=MyDocuments}/Artemis/logs/${shortdate}.txt";
|
|
||||||
fileTarget.Layout = "${longdate}|${level:uppercase=true}|${logger}|${message} ${exception:format=tostring}";
|
fileTarget.Layout = "${longdate}|${level:uppercase=true}|${logger}|${message} ${exception:format=tostring}";
|
||||||
fileTarget.EnableFileDelete = true;
|
fileTarget.FileName = "${specialfolder:folder=MyDocuments}/Artemis/logs/log.txt";
|
||||||
|
fileTarget.ArchiveFileName = "${specialfolder:folder=MyDocuments}/Artemis/logs/log-{#}.txt";
|
||||||
|
fileTarget.ArchiveEvery = FileArchivePeriod.Day;
|
||||||
|
fileTarget.ArchiveNumbering = ArchiveNumberingMode.Date;
|
||||||
|
fileTarget.ArchiveOldFileOnStartup = true;
|
||||||
fileTarget.MaxArchiveFiles = 7;
|
fileTarget.MaxArchiveFiles = 7;
|
||||||
fileTarget.ArchiveEvery = FileArchivePeriod.Minute;
|
|
||||||
|
|
||||||
// Step 4. Define rules
|
// Step 4. Define rules
|
||||||
var rule1 = new LoggingRule("*", logLevel, debuggerTarget);
|
var rule1 = new LoggingRule("*", logLevel, debuggerTarget);
|
||||||
@ -53,9 +55,12 @@ namespace Artemis.Utilities
|
|||||||
// Step 5. Activate the configuration
|
// Step 5. Activate the configuration
|
||||||
LogManager.Configuration = config;
|
LogManager.Configuration = config;
|
||||||
|
|
||||||
// Log as fatal so it always shows
|
// Log as fatal so it always shows, add some spacing since this indicates the start of a new log
|
||||||
var logger = LogManager.GetCurrentClassLogger();
|
var logger = LogManager.GetCurrentClassLogger();
|
||||||
logger.Fatal("INFO: Set log level to {0}", logLevel);
|
var logMsg = $" INFO: Set log level to {logLevel} ";
|
||||||
|
logger.Fatal(new string('-', logMsg.Length));
|
||||||
|
logger.Fatal(logMsg);
|
||||||
|
logger.Fatal(new string('-', logMsg.Length));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void MemoryTargetOnEventReceived(LogEventInfo logEventInfo)
|
private static void MemoryTargetOnEventReceived(LogEventInfo logEventInfo)
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Dynamic;
|
using System.Dynamic;
|
||||||
@ -12,6 +13,7 @@ using Caliburn.Micro;
|
|||||||
using MahApps.Metro.Controls;
|
using MahApps.Metro.Controls;
|
||||||
using NLog;
|
using NLog;
|
||||||
using ILogger = Ninject.Extensions.Logging.ILogger;
|
using ILogger = Ninject.Extensions.Logging.ILogger;
|
||||||
|
using Process = System.Diagnostics.Process;
|
||||||
|
|
||||||
namespace Artemis.ViewModels.Flyouts
|
namespace Artemis.ViewModels.Flyouts
|
||||||
{
|
{
|
||||||
@ -201,6 +203,12 @@ namespace Artemis.ViewModels.Flyouts
|
|||||||
MainManager.EnableProgram();
|
MainManager.EnableProgram();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ShowLogs()
|
||||||
|
{
|
||||||
|
var logPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Artemis\logs";
|
||||||
|
System.Diagnostics.Process.Start(logPath);
|
||||||
|
}
|
||||||
|
|
||||||
public void ShowDebug()
|
public void ShowDebug()
|
||||||
{
|
{
|
||||||
IWindowManager manager = new WindowManager();
|
IWindowManager manager = new WindowManager();
|
||||||
|
|||||||
@ -102,16 +102,19 @@
|
|||||||
<ComboBox Grid.Row="9" Grid.Column="1" x:Name="LogLevels" Margin="10" VerticalAlignment="Center"
|
<ComboBox Grid.Row="9" Grid.Column="1" x:Name="LogLevels" Margin="10" VerticalAlignment="Center"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Width="140" />
|
Width="140" />
|
||||||
|
<Button Grid.Row="10" Grid.Column="0" Margin="10" x:Name="ShowLogs" Content="Show logs"
|
||||||
|
VerticalAlignment="Center" Width="100" HorizontalAlignment="Left"
|
||||||
|
Style="{DynamicResource SquareButtonStyle}" />
|
||||||
<Button Grid.Row="10" Grid.Column="1" Margin="10" x:Name="ShowDebug" Content="Show debugger"
|
<Button Grid.Row="10" Grid.Column="1" Margin="10" x:Name="ShowDebug" Content="Show debugger"
|
||||||
VerticalAlignment="Center" Width="90" HorizontalAlignment="Right"
|
VerticalAlignment="Center" Width="100" HorizontalAlignment="Right"
|
||||||
Style="{DynamicResource SquareButtonStyle}" />
|
Style="{DynamicResource SquareButtonStyle}" />
|
||||||
|
|
||||||
<!-- Buttons -->
|
<!-- Buttons -->
|
||||||
<Button Grid.Row="11" Grid.Column="0" Margin="10" x:Name="ResetSettings" Content="Reset settings"
|
<Button Grid.Row="11" Grid.Column="0" Margin="10" x:Name="ResetSettings" Content="Reset settings"
|
||||||
VerticalAlignment="Center" HorizontalAlignment="Left" Width="90"
|
VerticalAlignment="Center" HorizontalAlignment="Left" Width="100"
|
||||||
Style="{DynamicResource SquareButtonStyle}" />
|
Style="{DynamicResource SquareButtonStyle}" />
|
||||||
<Button Grid.Row="11" Grid.Column="1" Margin="11" x:Name="SaveSettings" Content="Save changes"
|
<Button Grid.Row="11" Grid.Column="1" Margin="11" x:Name="SaveSettings" Content="Save changes"
|
||||||
VerticalAlignment="Center" HorizontalAlignment="Right" Width="90"
|
VerticalAlignment="Center" HorizontalAlignment="Right" Width="100"
|
||||||
Style="{DynamicResource SquareButtonStyle}" />
|
Style="{DynamicResource SquareButtonStyle}" />
|
||||||
|
|
||||||
<!-- Version -->
|
<!-- Version -->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user