Skip to content

Commit 3a74b1b

Browse files
committedMar 31, 2020
Merge branch 'kaqq-master'
2 parents c9750dc + bb0306c commit 3a74b1b

File tree

5 files changed

+139
-17
lines changed

5 files changed

+139
-17
lines changed
 

‎src/Logbert/App.config

+18
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,24 @@
580580
<setting name="ColumnizerRepository" serializeAs="String">
581581
<value>columnizer.xml</value>
582582
</setting>
583+
<setting name="Log4NetLevelTrace" serializeAs="String">
584+
<value>TRACE</value>
585+
</setting>
586+
<setting name="Log4NetLevelDebug" serializeAs="String">
587+
<value>DEBUG</value>
588+
</setting>
589+
<setting name="Log4NetLevelInfo" serializeAs="String">
590+
<value>INFO</value>
591+
</setting>
592+
<setting name="Log4NetLeveLWarning" serializeAs="String">
593+
<value>WARN</value>
594+
</setting>
595+
<setting name="Log4NetLevelError" serializeAs="String">
596+
<value>ERROR</value>
597+
</setting>
598+
<setting name="Log4NetLevelFatal" serializeAs="String">
599+
<value>FATAL</value>
600+
</setting>
583601
</Couchcoding.Logbert.Properties.Settings>
584602
</applicationSettings>
585603
</configuration>

‎src/Logbert/Logbert.csproj

+22
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,21 @@
3030
</UpgradeBackupLocation>
3131
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
3232
<TargetFrameworkProfile />
33+
<PublishUrl>publish\</PublishUrl>
34+
<Install>true</Install>
35+
<InstallFrom>Disk</InstallFrom>
36+
<UpdateEnabled>false</UpdateEnabled>
37+
<UpdateMode>Foreground</UpdateMode>
38+
<UpdateInterval>7</UpdateInterval>
39+
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
40+
<UpdatePeriodically>false</UpdatePeriodically>
41+
<UpdateRequired>false</UpdateRequired>
42+
<MapFileExtensions>true</MapFileExtensions>
43+
<ApplicationRevision>0</ApplicationRevision>
44+
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
45+
<IsWebBootstrapper>false</IsWebBootstrapper>
46+
<UseApplicationTrust>false</UseApplicationTrust>
47+
<BootstrapperEnabled>true</BootstrapperEnabled>
3348
</PropertyGroup>
3449
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
3550
<DebugSymbols>true</DebugSymbols>
@@ -642,6 +657,13 @@
642657
<Name>Couchcoding.Logbert.Theme</Name>
643658
</ProjectReference>
644659
</ItemGroup>
660+
<ItemGroup>
661+
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
662+
<Visible>False</Visible>
663+
<ProductName>.NET Framework 3.5 SP1</ProductName>
664+
<Install>false</Install>
665+
</BootstrapperPackage>
666+
</ItemGroup>
645667
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
646668
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
647669
Other similar extension points exist, see Microsoft.Common.targets.

‎src/Logbert/Logging/LogMessageLog4Net.cs

+24-14
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
using MoonSharp.Interpreter;
4040
using System.Globalization;
41+
using System.Text.RegularExpressions;
4142

4243
namespace Couchcoding.Logbert.Logging
4344
{
@@ -249,7 +250,7 @@ private bool ParseData(string data)
249250
}
250251

251252
long timestamp;
252-
mTimestamp = long.TryParse(reader.GetAttribute("timestamp"), out timestamp)
253+
mTimestamp = long.TryParse(reader.GetAttribute("timestamp"), out timestamp)
253254
? mUtcStartDate.AddMilliseconds(timestamp)
254255
: DateTime.Now;
255256

@@ -327,20 +328,29 @@ private LogLevel MapLevelType(string levelType)
327328
{
328329
if (!string.IsNullOrEmpty(levelType))
329330
{
330-
switch (levelType.ToUpper())
331+
if (Regex.IsMatch(levelType, Settings.Default.Log4NetLevelDebug))
331332
{
332-
case "TRACE":
333-
return LogLevel.Trace;
334-
case "DEBUG":
335-
return LogLevel.Debug;
336-
case "INFO":
337-
return LogLevel.Info;
338-
case "WARN":
339-
return LogLevel.Warning;
340-
case "ERROR":
341-
return LogLevel.Error;
342-
case "FATAL":
343-
return LogLevel.Fatal;
333+
return LogLevel.Debug;
334+
}
335+
336+
if (Regex.IsMatch(levelType, Settings.Default.Log4NetLevelInfo))
337+
{
338+
return LogLevel.Info;
339+
}
340+
341+
if (Regex.IsMatch(levelType, Settings.Default.Log4NetLeveLWarning))
342+
{
343+
return LogLevel.Warning;
344+
}
345+
346+
if (Regex.IsMatch(levelType, Settings.Default.Log4NetLevelError))
347+
{
348+
return LogLevel.Error;
349+
}
350+
351+
if (Regex.IsMatch(levelType, Settings.Default.Log4NetLevelFatal))
352+
{
353+
return LogLevel.Fatal;
344354
}
345355
}
346356

‎src/Logbert/Properties/Settings.Designer.cs

+55-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/Logbert/Properties/Settings.settings

+20-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version='1.0' encoding='utf-8'?>
1+
<?xml version='1.0' encoding='utf-8'?>
22
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Couchcoding.Logbert.Properties" GeneratedClassName="Settings">
33
<Profiles />
44
<Settings>
@@ -536,5 +536,23 @@
536536
<Setting Name="FrmMainShowWelcomePage" Type="System.Boolean" Scope="User">
537537
<Value Profile="(Default)">True</Value>
538538
</Setting>
539+
<Setting Name="Log4NetLevelTrace" Type="System.String" Scope="Application">
540+
<Value Profile="(Default)">TRACE</Value>
541+
</Setting>
542+
<Setting Name="Log4NetLevelDebug" Type="System.String" Scope="Application">
543+
<Value Profile="(Default)">DEBUG</Value>
544+
</Setting>
545+
<Setting Name="Log4NetLevelInfo" Type="System.String" Scope="Application">
546+
<Value Profile="(Default)">INFO</Value>
547+
</Setting>
548+
<Setting Name="Log4NetLeveLWarning" Type="System.String" Scope="Application">
549+
<Value Profile="(Default)">WARN</Value>
550+
</Setting>
551+
<Setting Name="Log4NetLevelError" Type="System.String" Scope="Application">
552+
<Value Profile="(Default)">ERROR</Value>
553+
</Setting>
554+
<Setting Name="Log4NetLevelFatal" Type="System.String" Scope="Application">
555+
<Value Profile="(Default)">FATAL</Value>
556+
</Setting>
539557
</Settings>
540-
</SettingsFile>
558+
</SettingsFile>

0 commit comments

Comments
 (0)