Skip to content

Commit f35319f

Browse files
committed
Line ending normalization.
1 parent 3048afc commit f35319f

File tree

3 files changed

+116
-115
lines changed

3 files changed

+116
-115
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,4 @@ FakesAssemblies/
194194

195195
# Visual Studio 6 workspace options file
196196
*.opt
197+
*.orig

samples/Sample/Program.cs

Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,70 @@
1-
using System;
2-
using Microsoft.Framework.Logging;
3-
using ILogger = Microsoft.Framework.Logging.ILogger;
4-
using Serilog;
5-
6-
namespace Sample
7-
{
8-
public class Program
9-
{
10-
private readonly ILogger _logger;
11-
12-
public Program()
13-
{
14-
Log.Logger = new LoggerConfiguration()
15-
.MinimumLevel.Debug()
16-
#if DNXCORE50
17-
.WriteTo.TextWriter(Console.Out)
18-
#else
19-
.Enrich.WithMachineName()
20-
.Enrich.WithProcessId()
21-
.Enrich.WithThreadId()
22-
.WriteTo.ColoredConsole()
23-
#endif
24-
.CreateLogger();
25-
26-
_logger = new LoggerFactory()
27-
.AddSerilog()
28-
.CreateLogger(typeof(Program).FullName);
29-
}
30-
31-
public void Main(string[] args)
32-
{
33-
_logger.LogInformation("Starting");
34-
35-
var startTime = DateTimeOffset.UtcNow;
36-
_logger.LogInformation(1, "Started at {StartTime} and 0x{Hello:X} is hex of 42", startTime, 42);
37-
38-
try
39-
{
40-
throw new Exception("Boom");
41-
}
42-
catch (Exception ex)
43-
{
44-
_logger.LogCritical("Unexpected critical error starting application", ex);
45-
_logger.Log(LogLevel.Critical, 0, "Unexpected critical error", ex, null);
46-
// This write should not log anything
47-
_logger.Log(LogLevel.Critical, 0, null, null, null);
48-
_logger.LogError("Unexpected error", ex);
49-
_logger.LogWarning("Unexpected warning", ex);
50-
}
51-
52-
using (_logger.BeginScope("Main"))
53-
{
54-
_logger.LogInformation("Waiting for user input");
55-
var key = Console.Read();
56-
_logger.LogInformation("User pressed {@KeyInfo}", new { Key = key, KeyChar = (char)key });
57-
}
58-
59-
var endTime = DateTimeOffset.UtcNow;
60-
_logger.LogInformation(2, "Stopping at {StopTime}", endTime);
61-
62-
_logger.LogInformation("Stopping");
63-
64-
_logger.LogInformation(Environment.NewLine);
65-
_logger.LogInformation("{Result,-10:l}{StartTime,15:l}{EndTime,15:l}{Duration,15:l}", "RESULT", "START TIME", "END TIME", "DURATION(ms)");
66-
_logger.LogInformation("{Result,-10:l}{StartTime,15:l}{EndTime,15:l}{Duration,15:l}", "------", "----- ----", "--- ----", "------------");
67-
_logger.LogInformation("{Result,-10:l}{StartTime,15:mm:s tt}{EndTime,15:mm:s tt}{Duration,15}", "SUCCESS", startTime, endTime, (endTime - startTime).TotalMilliseconds);
68-
}
69-
}
70-
}
1+
using System;
2+
using Microsoft.Framework.Logging;
3+
using ILogger = Microsoft.Framework.Logging.ILogger;
4+
using Serilog;
5+
6+
namespace Sample
7+
{
8+
public class Program
9+
{
10+
private readonly ILogger _logger;
11+
12+
public Program()
13+
{
14+
Log.Logger = new LoggerConfiguration()
15+
.MinimumLevel.Debug()
16+
#if DNXCORE50
17+
.WriteTo.TextWriter(Console.Out)
18+
#else
19+
.Enrich.WithMachineName()
20+
.Enrich.WithProcessId()
21+
.Enrich.WithThreadId()
22+
.WriteTo.ColoredConsole()
23+
#endif
24+
.CreateLogger();
25+
26+
_logger = new LoggerFactory()
27+
.AddSerilog()
28+
.CreateLogger(typeof(Program).FullName);
29+
}
30+
31+
public void Main(string[] args)
32+
{
33+
_logger.LogInformation("Starting");
34+
35+
var startTime = DateTimeOffset.UtcNow;
36+
_logger.LogInformation(1, "Started at {StartTime} and 0x{Hello:X} is hex of 42", startTime, 42);
37+
38+
try
39+
{
40+
throw new Exception("Boom");
41+
}
42+
catch (Exception ex)
43+
{
44+
_logger.LogCritical("Unexpected critical error starting application", ex);
45+
_logger.Log(LogLevel.Critical, 0, "Unexpected critical error", ex, null);
46+
// This write should not log anything
47+
_logger.Log(LogLevel.Critical, 0, null, null, null);
48+
_logger.LogError("Unexpected error", ex);
49+
_logger.LogWarning("Unexpected warning", ex);
50+
}
51+
52+
using (_logger.BeginScope("Main"))
53+
{
54+
_logger.LogInformation("Waiting for user input");
55+
var key = Console.Read();
56+
_logger.LogInformation("User pressed {@KeyInfo}", new { Key = key, KeyChar = (char)key });
57+
}
58+
59+
var endTime = DateTimeOffset.UtcNow;
60+
_logger.LogInformation(2, "Stopping at {StopTime}", endTime);
61+
62+
_logger.LogInformation("Stopping");
63+
64+
_logger.LogInformation(Environment.NewLine);
65+
_logger.LogInformation("{Result,-10:l}{StartTime,15:l}{EndTime,15:l}{Duration,15:l}", "RESULT", "START TIME", "END TIME", "DURATION(ms)");
66+
_logger.LogInformation("{Result,-10:l}{StartTime,15:l}{EndTime,15:l}{Duration,15:l}", "------", "----- ----", "--- ----", "------------");
67+
_logger.LogInformation("{Result,-10:l}{StartTime,15:mm:s tt}{EndTime,15:mm:s tt}{Duration,15}", "SUCCESS", startTime, endTime, (endTime - startTime).TotalMilliseconds);
68+
}
69+
}
70+
}

serilog-framework-logging.sln

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,45 @@
1-
2-
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 14
4-
VisualStudioVersion = 14.0.22823.1
5-
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A1893BD1-333D-4DFE-A0F0-DDBB2FE526E0}"
7-
EndProject
8-
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Serilog.Framework.Logging", "src\Serilog.Framework.Logging\Serilog.Framework.Logging.xproj", "{903CD13A-D54B-4CEC-A55F-E22AE3D93B3B}"
9-
EndProject
10-
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Serilog.Framework.Logging.Tests", "test\Serilog.Framework.Logging.Tests\Serilog.Framework.Logging.Tests.xproj", "{37EADF84-5E41-4224-A194-1E3299DCD0B8}"
11-
EndProject
12-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{E30F638E-BBBE-4AD1-93CE-48CC69CFEFE1}"
13-
EndProject
14-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{F2407211-6043-439C-8E06-3641634332E7}"
15-
EndProject
16-
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Sample", "samples\Sample\Sample.xproj", "{65357FBC-9BC4-466D-B621-1C3A19BC2A78}"
17-
EndProject
18-
Global
19-
GlobalSection(SolutionConfigurationPlatforms) = preSolution
20-
Debug|Any CPU = Debug|Any CPU
21-
Release|Any CPU = Release|Any CPU
22-
EndGlobalSection
23-
GlobalSection(ProjectConfigurationPlatforms) = postSolution
24-
{903CD13A-D54B-4CEC-A55F-E22AE3D93B3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
25-
{903CD13A-D54B-4CEC-A55F-E22AE3D93B3B}.Debug|Any CPU.Build.0 = Debug|Any CPU
26-
{903CD13A-D54B-4CEC-A55F-E22AE3D93B3B}.Release|Any CPU.ActiveCfg = Release|Any CPU
27-
{903CD13A-D54B-4CEC-A55F-E22AE3D93B3B}.Release|Any CPU.Build.0 = Release|Any CPU
28-
{37EADF84-5E41-4224-A194-1E3299DCD0B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29-
{37EADF84-5E41-4224-A194-1E3299DCD0B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
30-
{37EADF84-5E41-4224-A194-1E3299DCD0B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
31-
{37EADF84-5E41-4224-A194-1E3299DCD0B8}.Release|Any CPU.Build.0 = Release|Any CPU
32-
{65357FBC-9BC4-466D-B621-1C3A19BC2A78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33-
{65357FBC-9BC4-466D-B621-1C3A19BC2A78}.Debug|Any CPU.Build.0 = Debug|Any CPU
34-
{65357FBC-9BC4-466D-B621-1C3A19BC2A78}.Release|Any CPU.ActiveCfg = Release|Any CPU
35-
{65357FBC-9BC4-466D-B621-1C3A19BC2A78}.Release|Any CPU.Build.0 = Release|Any CPU
36-
EndGlobalSection
37-
GlobalSection(SolutionProperties) = preSolution
38-
HideSolutionNode = FALSE
39-
EndGlobalSection
40-
GlobalSection(NestedProjects) = preSolution
41-
{903CD13A-D54B-4CEC-A55F-E22AE3D93B3B} = {A1893BD1-333D-4DFE-A0F0-DDBB2FE526E0}
42-
{37EADF84-5E41-4224-A194-1E3299DCD0B8} = {E30F638E-BBBE-4AD1-93CE-48CC69CFEFE1}
43-
{65357FBC-9BC4-466D-B621-1C3A19BC2A78} = {F2407211-6043-439C-8E06-3641634332E7}
44-
EndGlobalSection
45-
EndGlobal
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.22823.1
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A1893BD1-333D-4DFE-A0F0-DDBB2FE526E0}"
7+
EndProject
8+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Serilog.Framework.Logging", "src\Serilog.Framework.Logging\Serilog.Framework.Logging.xproj", "{903CD13A-D54B-4CEC-A55F-E22AE3D93B3B}"
9+
EndProject
10+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Serilog.Framework.Logging.Tests", "test\Serilog.Framework.Logging.Tests\Serilog.Framework.Logging.Tests.xproj", "{37EADF84-5E41-4224-A194-1E3299DCD0B8}"
11+
EndProject
12+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{E30F638E-BBBE-4AD1-93CE-48CC69CFEFE1}"
13+
EndProject
14+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{F2407211-6043-439C-8E06-3641634332E7}"
15+
EndProject
16+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Sample", "samples\Sample\Sample.xproj", "{65357FBC-9BC4-466D-B621-1C3A19BC2A78}"
17+
EndProject
18+
Global
19+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
20+
Debug|Any CPU = Debug|Any CPU
21+
Release|Any CPU = Release|Any CPU
22+
EndGlobalSection
23+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
24+
{903CD13A-D54B-4CEC-A55F-E22AE3D93B3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
25+
{903CD13A-D54B-4CEC-A55F-E22AE3D93B3B}.Debug|Any CPU.Build.0 = Debug|Any CPU
26+
{903CD13A-D54B-4CEC-A55F-E22AE3D93B3B}.Release|Any CPU.ActiveCfg = Release|Any CPU
27+
{903CD13A-D54B-4CEC-A55F-E22AE3D93B3B}.Release|Any CPU.Build.0 = Release|Any CPU
28+
{37EADF84-5E41-4224-A194-1E3299DCD0B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29+
{37EADF84-5E41-4224-A194-1E3299DCD0B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
30+
{37EADF84-5E41-4224-A194-1E3299DCD0B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
31+
{37EADF84-5E41-4224-A194-1E3299DCD0B8}.Release|Any CPU.Build.0 = Release|Any CPU
32+
{65357FBC-9BC4-466D-B621-1C3A19BC2A78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33+
{65357FBC-9BC4-466D-B621-1C3A19BC2A78}.Debug|Any CPU.Build.0 = Debug|Any CPU
34+
{65357FBC-9BC4-466D-B621-1C3A19BC2A78}.Release|Any CPU.ActiveCfg = Release|Any CPU
35+
{65357FBC-9BC4-466D-B621-1C3A19BC2A78}.Release|Any CPU.Build.0 = Release|Any CPU
36+
EndGlobalSection
37+
GlobalSection(SolutionProperties) = preSolution
38+
HideSolutionNode = FALSE
39+
EndGlobalSection
40+
GlobalSection(NestedProjects) = preSolution
41+
{903CD13A-D54B-4CEC-A55F-E22AE3D93B3B} = {A1893BD1-333D-4DFE-A0F0-DDBB2FE526E0}
42+
{37EADF84-5E41-4224-A194-1E3299DCD0B8} = {E30F638E-BBBE-4AD1-93CE-48CC69CFEFE1}
43+
{65357FBC-9BC4-466D-B621-1C3A19BC2A78} = {F2407211-6043-439C-8E06-3641634332E7}
44+
EndGlobalSection
45+
EndGlobal

0 commit comments

Comments
 (0)