Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Commit a6b0cd5

Browse files
committedJan 27, 2016
Revise LogLevel Enum
1 parent 2c465f4 commit a6b0cd5

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed
 

‎src/Microsoft.Extensions.Logging.Abstractions/LogLevel.cs

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,40 +12,40 @@ public enum LogLevel
1212
/// Logs that contain the most detailed messages. These messages may contain sensitive application data.
1313
/// These messages are disabled by default and should never be enabled in a production environment.
1414
/// </summary>
15-
Trace = 1,
15+
Trace = 0,
1616

1717
/// <summary>
1818
/// Logs that are used for interactive investigation during development. These logs should primarily contain
1919
/// information useful for debugging and have no long-term value.
2020
/// </summary>
21-
Debug = 2,
21+
Debug = 1,
2222

2323
/// <summary>
2424
/// Logs that track the general flow of the application. These logs should have long-term value.
2525
/// </summary>
26-
Information = 3,
26+
Information = 2,
2727

2828
/// <summary>
2929
/// Logs that highlight an abnormal or unexpected event in the application flow, but do not otherwise cause the
3030
/// application execution to stop.
3131
/// </summary>
32-
Warning = 4,
32+
Warning = 3,
3333

3434
/// <summary>
3535
/// Logs that highlight when the current flow of execution is stopped due to a failure. These should indicate a
3636
/// failure in the current activity, not an application-wide failure.
3737
/// </summary>
38-
Error = 5,
38+
Error = 4,
3939

4040
/// <summary>
4141
/// Logs that describe an unrecoverable application or system crash, or a catastrophic failure that requires
4242
/// immediate attention.
4343
/// </summary>
44-
Critical = 6,
44+
Critical = 5,
4545

4646
/// <summary>
4747
/// Not used for writing log messages. Specifies that a logging category should not write any messages.
4848
/// </summary>
49-
None = int.MaxValue,
49+
None = 6,
5050
}
5151
}

‎test/Microsoft.Extensions.Logging.Test/LogLevelEnumTest.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ namespace Microsoft.Extensions.Logging.Test
1111
public class LogLevelEnumTest
1212
{
1313
[Fact]
14-
public static void EnumStartsAtOne()
14+
public static void EnumStartsAtZero()
1515
{
16-
Assert.Equal(1, GetEnumValues().Min());
16+
Assert.Equal(0, GetEnumValues().Min());
1717
}
1818

1919
[Fact]
2020
public static void EnumValuesAreUniqueAndConsecutive()
2121
{
2222
var values = GetEnumValues();
2323
values.Sort();
24-
Assert.Equal(new[] { 1, 2, 3, 4, 5, 6, int.MaxValue}, values);
24+
Assert.Equal(new[] { 0, 1, 2, 3, 4, 5, 6 }, values);
2525
}
2626

2727
private static List<int> GetEnumValues()

‎test/Microsoft.Extensions.Logging.Test/LoggerTest.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public void Log_IgnoresExceptionInIntermediateLoggersAndThrowsAggregateException
2626
// Assert
2727
Assert.Equal(new[] { "provider1.Test-Hello!", "provider3.Test-Hello!" }, store);
2828
Assert.NotNull(aggregateException);
29-
Assert.Equal("An error occurred while writing to logger(s).", aggregateException.Message);
29+
Assert.StartsWith("An error occurred while writing to logger(s).", aggregateException.Message);
3030
Assert.Equal(1, aggregateException.InnerExceptions.Count);
3131
var exception = aggregateException.InnerExceptions[0];
3232
Assert.Equal("provider2.Test-Error occurred while logging data.", exception.Message);
@@ -49,7 +49,7 @@ public void BeginScope_IgnoresExceptionInIntermediateLoggersAndThrowsAggregateEx
4949
// Assert
5050
Assert.Equal(new[] { "provider1.Test-Scope1", "provider3.Test-Scope1" }, store);
5151
Assert.NotNull(aggregateException);
52-
Assert.Equal("An error occurred while writing to logger(s).", aggregateException.Message);
52+
Assert.StartsWith("An error occurred while writing to logger(s).", aggregateException.Message);
5353
Assert.Equal(1, aggregateException.InnerExceptions.Count);
5454
var exception = aggregateException.InnerExceptions[0];
5555
Assert.Equal("provider2.Test-Error occurred while creating scope.", exception.Message);
@@ -72,7 +72,7 @@ public void IsEnabled_IgnoresExceptionInIntermediateLoggers()
7272
// Assert
7373
Assert.Equal(new[] { "provider1.Test-Hello!", "provider3.Test-Hello!" }, store);
7474
Assert.NotNull(aggregateException);
75-
Assert.Equal("An error occurred while writing to logger(s).", aggregateException.Message);
75+
Assert.StartsWith("An error occurred while writing to logger(s).", aggregateException.Message);
7676
Assert.Equal(1, aggregateException.InnerExceptions.Count);
7777
var exception = aggregateException.InnerExceptions[0];
7878
Assert.Equal("provider2.Test-Error occurred while checking if logger is enabled.", exception.Message);
@@ -94,7 +94,7 @@ public void Log_AggregatesExceptionsFromMultipleLoggers()
9494
// Assert
9595
Assert.Empty(store);
9696
Assert.NotNull(aggregateException);
97-
Assert.Equal("An error occurred while writing to logger(s).", aggregateException.Message);
97+
Assert.StartsWith("An error occurred while writing to logger(s).", aggregateException.Message);
9898
var exceptions = aggregateException.InnerExceptions;
9999
Assert.Equal(2, exceptions.Count);
100100
Assert.Equal("provider1.Test-Error occurred while logging data.", exceptions[0].Message);

0 commit comments

Comments
 (0)