Skip to content

Commit c7b7ca0

Browse files
committed
Nuget update
1 parent 945473e commit c7b7ca0

9 files changed

Lines changed: 170 additions & 79 deletions

File tree

samples/LoggingReflectInsight/Console.ReflectInsightSample/Program.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,16 @@ namespace Console.ReflectInsightSample
1414
/// </summary>
1515
public class Program
1616
{
17-
private static LoggerFactory _factory;
18-
19-
/// <summary>
2017
/// Mains the specified arguments.
2118
/// </summary>
2219
/// <param name="args">The arguments.</param>
2320
public static void Main(string[] args)
2421
{
25-
_factory = new LoggerFactory();
26-
_factory.MinimumLevel = LogLevel.Debug;
27-
_factory.AddReflectInsight();
22+
var loggerFactory = new LoggerFactory();
23+
loggerFactory.MinimumLevel = LogLevel.Debug;
24+
loggerFactory.AddReflectInsight();
2825

29-
var logger = _factory.CreateLogger<Program>();
26+
var logger = loggerFactory.CreateLogger<Program>();
3027

3128
var exception = new Exception("Some Exception...");
3229
var logValues = new Dictionary<string, object>();
@@ -36,26 +33,32 @@ public static void Main(string[] args)
3633

3734
logger.LogDebug("LogDebug");
3835
logger.LogDebug("LogDebug", exception);
36+
logger.LogDebug(logValues, "LogDebug", exception);
3937
logger.LogDebug(logValues, exception);
4038

4139
logger.LogVerbose("LogVerbose");
4240
logger.LogVerbose("LogVerbose", exception);
41+
logger.LogVerbose(logValues, "LogVerbose", exception);
4342
logger.LogVerbose(logValues, exception);
4443

4544
logger.LogInformation("LogInformation");
4645
logger.LogInformation("LogInformation", exception);
46+
logger.LogInformation(logValues, "LogInformation", exception);
4747
logger.LogInformation(logValues, exception);
4848

4949
logger.LogWarning("LogWarning");
5050
logger.LogWarning("LogWarning", exception);
51+
logger.LogWarning(logValues, "LogWarning", exception);
5152
logger.LogWarning(logValues, exception);
5253

5354
logger.LogError("LogError");
5455
logger.LogError("LogError", exception);
56+
logger.LogError(logValues, "LogError", exception);
5557
logger.LogError(logValues, exception);
5658

5759
logger.LogCritical("LogCritical");
5860
logger.LogCritical("LogCritical", exception);
61+
logger.LogCritical(logValues, "LogCritical", exception);
5962
logger.LogCritical(logValues, exception);
6063

6164
System.Console.WriteLine("Press any key to continue...");

samples/LoggingReflectInsight/Console.ReflectInsightSample/ReflectInsight.config

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
For Console or TextFile the following messageDetails are allowed:
2323
messageDetails = Message|Details|Properties|ExtendedProperties Note: Message is always assumed even if not supplied
2424
messagePattern = %message% %messagetype% %category% %machine% %sessionid% %requestid% %processid% %threadid% %domainid% %application% %userdomain% %username% %time% %time{MM-dd-yyyy, HH:mm:ss}% %utctime% %utctime{MM-dd-yyyy, HH:mm:ss}% %newline%
25-
examples for messagePatterns:
25+
examples for messagePatterns:
2626
- %time% %message% - %threadid%%newline%%application%
2727
- %time{yyMMdd, hh:mm}% %message% [%messagetype%]
2828
- %time{hh:mm:ss.fff}% - %message%, %application%, %threadid%
@@ -41,15 +41,19 @@
4141
<group name="Development" enabled="true">
4242
<destinations>
4343
<destination name="Viewer" enabled="true" filter="Level_Trace" details="Viewer" />
44+
<!--
4445
<destination name="BinaryFile" enabled="true" filter="Level_Trace" details="BinaryFile[path=.\Logs\Sample.rlg; autoSave=Weekly]" />
4546
<destination name="TextFile" enabled="true" filter="Level_Trace" details="TextFile[path=.\Logs\Sample.txt; messageDetails=Message|Details; messagePattern=pattern1; autoSave=Weekly]" />
47+
-->
4648
</destinations>
4749
</group>
4850
<group name="Release" enabled="true">
4951
<destinations>
5052
<destination name="Viewer" enabled="true" filter="Level_Info" details="Viewer" />
53+
<!--
5154
<destination name="BinaryFile" enabled="true" filter="Level_Info" details="BinaryFile[path=.\Logs\Sample.rlg; autoSave=Weekly]" />
5255
<destination name="TextFile" enabled="true" filter="Level_Info" details="TextFile[path=.\LogsSample.txt; messageDetails=Message|Details; messagePattern=pattern1; autoSave=Weekly]" />
56+
-->
5357
</destinations>
5458
</group>
5559
</listenerGroups>
@@ -76,6 +80,14 @@
7680
<method type="SendException" />
7781
<method type="SendFatal" />
7882
</filter>
83+
<filter name="Level_Verbose" mode="Include">
84+
<method type="SendVerbose" />
85+
<method type="SendInformation" />
86+
<method type="SendWarning" />
87+
<method type="SendError" />
88+
<method type="SendException" />
89+
<method type="SendFatal" />
90+
</filter>
7991
<filter name="Level_Info" mode="Include">
8092
<method type="SendSendMessage" />
8193
<method type="SendInformation" />

samples/LoggingReflectInsight/WebApi.ReflectInsightSample/Controllers/ValuesController.cs

Lines changed: 0 additions & 59 deletions
This file was deleted.

samples/LoggingReflectInsight/WebApi.ReflectInsightSample/Properties/launchSettings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"profiles": {
1111
"IIS Express": {
1212
"commandName": "IISExpress",
13-
"launchBrowser": true,
1413
"launchUrl": "api/values",
1514
"environmentVariables": {
1615
"Hosting:Environment": "Development"

samples/LoggingReflectInsight/WebApi.ReflectInsightSample/ReflectInsight.config

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
<?xml version="1.0"?>
2+
<!--
3+
ASP.NET.Plus
4+
Copyright (c) 2016 ZoneMatrix Inc.
5+
Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
6+
-->
27
<configuration>
38
<insightSettings>
49
<baseSettings>
510
<configChange enabled="true" />
611
<enable state="all" />
712
<propagateException enabled="false" />
813
<exceptionEventTracker time="5" />
9-
<senderName name="WebApi.ReflectInsightSample" />
14+
<senderName name="ReflectInsightSample" />
1015
</baseSettings>
1116

1217
<files default="Weekly">
@@ -17,7 +22,7 @@
1722
For Console or TextFile the following messageDetails are allowed:
1823
messageDetails = Message|Details|Properties|ExtendedProperties Note: Message is always assumed even if not supplied
1924
messagePattern = %message% %messagetype% %category% %machine% %sessionid% %requestid% %processid% %threadid% %domainid% %application% %userdomain% %username% %time% %time{MM-dd-yyyy, HH:mm:ss}% %utctime% %utctime{MM-dd-yyyy, HH:mm:ss}% %newline%
20-
examples for messagePatterns:
25+
examples for messagePatterns:
2126
- %time% %message% - %threadid%%newline%%application%
2227
- %time{yyMMdd, hh:mm}% %message% [%messagetype%]
2328
- %time{hh:mm:ss.fff}% - %message%, %application%, %threadid%
@@ -36,15 +41,19 @@
3641
<group name="Development" enabled="true">
3742
<destinations>
3843
<destination name="Viewer" enabled="true" filter="Level_Trace" details="Viewer" />
39-
<destination name="BinaryFile" enabled="true" filter="Level_Trace" details="BinaryFile[path=$(workingdir)\Logs\Sample.rlg; autoSave=Weekly]" />
40-
<destination name="TextFile" enabled="true" filter="Level_Trace" details="TextFile[path=$(workingdir)\Logs\Sample.txt; messageDetails=Message; messagePattern=pattern1; autoSave=Weekly]" />
44+
<!--
45+
<destination name="BinaryFile" enabled="true" filter="Level_Trace" details="BinaryFile[path=.\Logs\Sample.rlg; autoSave=Weekly]" />
46+
<destination name="TextFile" enabled="true" filter="Level_Trace" details="TextFile[path=.\Logs\Sample.txt; messageDetails=Message; messagePattern=pattern1; autoSave=Weekly]" />
47+
-->
4148
</destinations>
4249
</group>
4350
<group name="Release" enabled="true">
4451
<destinations>
4552
<destination name="Viewer" enabled="true" filter="Level_Info" details="Viewer" />
46-
<destination name="BinaryFile" enabled="true" filter="Level_Info" details="BinaryFile[path=$(workingdir)\Logs\Sample.rlg; autoSave=Weekly]" />
47-
<destination name="TextFile" enabled="true" filter="Level_Info" details="TextFile[path=$(workingdir)\Logs\Sample.txt; messageDetails=Message; messagePattern=pattern1; autoSave=Weekly]" />
53+
<!--
54+
<destination name="BinaryFile" enabled="true" filter="Level_Info" details="BinaryFile[path=.\Logs\Sample.rlg; autoSave=Weekly]" />
55+
<destination name="TextFile" enabled="true" filter="Level_Info" details="TextFile[path=.\Logs\Sample.txt; messageDetails=Message; messagePattern=pattern1; autoSave=Weekly]" />
56+
-->
4857
</destinations>
4958
</group>
5059
</listenerGroups>
@@ -53,6 +62,7 @@
5362
<filter name="Level_Trace" mode="Include">
5463
<method type="SendTrace" />
5564
<method type="SendDebug" />
65+
<method type="SendVerbose" />
5666
<method type="SendInformation" />
5767
<method type="SendWarning" />
5868
<method type="SendError" />
@@ -61,12 +71,21 @@
6171
</filter>
6272
<filter name="Level_Debug" mode="Include">
6373
<method type="SendDebug" />
74+
<method type="SendVerbose" />
6475
<method type="SendInformation" />
6576
<method type="SendWarning" />
6677
<method type="SendError" />
6778
<method type="SendException" />
6879
<method type="SendFatal" />
6980
</filter>
81+
<filter name="Level_Verbose" mode="Include">
82+
<method type="SendVerbose" />
83+
<method type="SendInformation" />
84+
<method type="SendWarning" />
85+
<method type="SendError" />
86+
<method type="SendException" />
87+
<method type="SendFatal" />
88+
</filter>
7089
<filter name="Level_Info" mode="Include">
7190
<method type="SendInformation" />
7291
<method type="SendWarning" />
@@ -86,20 +105,21 @@
86105
<method type="SendFatal" />
87106
</filter>
88107
<filter name="Level_Critical" mode="Include">
89-
<method type="SendFatal" />
108+
<method type="SendException" />
109+
<method type="SendFatal" />
90110
</filter>
91111
</filters>
92112

93113
<exceptionManagement mode="on">
94114
<publisher mode="on"
95115
name="EventPublisher"
96116
type="RI.Utils.ExceptionManagement.ExceptionEventPublisher, ReflectSoftware.Insight"
97-
applicationName="EndpointLoadAPI" />
117+
applicationName="ReflectInsightSample" />
98118

99119
<publisher mode="on"
100120
name="LogTextFilePublisher"
101121
type="RI.Utils.ExceptionManagement.ExceptionLogTextFilePublisher, ReflectSoftware.Insight"
102-
filePath="$(workingdir)\Logs\RI.Endpoints.Exceptions.txt"
122+
filePath=".\Logs\RI.Exceptions.txt"
103123
recycle="7" />
104124
</exceptionManagement>
105125

samples/LoggingReflectInsight/WebApi.ReflectInsightSample/Startup.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
using Microsoft.Extensions.Configuration;
99
using Microsoft.Extensions.DependencyInjection;
1010
using Microsoft.Extensions.Logging;
11+
using System;
12+
using System.Collections.Generic;
1113

1214
namespace WebApi.ReflectInsightSample
1315
{
@@ -63,6 +65,38 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
6365

6466
app.UseIISPlatformHandler();
6567
app.UseMvc();
68+
69+
var logger = loggerFactory.CreateLogger<Startup>();
70+
71+
var exception = new Exception("Some Exception...");
72+
var logValues = new Dictionary<string, object>();
73+
logValues["key1"] = "value1";
74+
logValues["key2"] = "value2";
75+
logValues["key3"] = new { Name = "John", Age = 100 };
76+
77+
logger.LogDebug("LogDebug");
78+
logger.LogDebug("LogDebug", exception);
79+
logger.LogDebug(logValues, exception);
80+
81+
logger.LogVerbose("LogVerbose");
82+
logger.LogVerbose("LogVerbose", exception);
83+
logger.LogVerbose(logValues, exception);
84+
85+
logger.LogInformation("LogInformation");
86+
logger.LogInformation("LogInformation", exception);
87+
logger.LogInformation(logValues, exception);
88+
89+
logger.LogWarning("LogWarning");
90+
logger.LogWarning("LogWarning", exception);
91+
logger.LogWarning(logValues, exception);
92+
93+
logger.LogError("LogError");
94+
logger.LogError("LogError", exception);
95+
logger.LogError(logValues, exception);
96+
97+
logger.LogCritical("LogCritical");
98+
logger.LogCritical("LogCritical", exception);
99+
logger.LogCritical(logValues, exception);
66100
}
67101

68102
// Entry point for the application.

samples/LoggingReflectInsight/WebApi.ReflectInsightSample/WebApi.ReflectInsightSample.xproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
</PropertyGroup>
1414
<PropertyGroup>
1515
<SchemaVersion>2.0</SchemaVersion>
16+
<TypeScriptCompileBlocked>True</TypeScriptCompileBlocked>
1617
</PropertyGroup>
1718
<ItemGroup>
1819
<Content Include="..\..\..\header\AspNet.Plus.licenseheader">

0 commit comments

Comments
 (0)