-
Notifications
You must be signed in to change notification settings - Fork 125
Reject Empty path values #258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
64f8e1b
fc99f80
83f4970
19e0df1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -267,8 +267,10 @@ public static LoggerConfiguration File( | |
TimeSpan? retainedFileTimeLimit = null) | ||
{ | ||
if (sinkConfiguration == null) throw new ArgumentNullException(nameof(sinkConfiguration)); | ||
if (path == null) throw new ArgumentNullException(nameof(path)); | ||
if (outputTemplate == null) throw new ArgumentNullException(nameof(outputTemplate)); | ||
|
||
// check if null or empty on these. | ||
AraHaan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if (string.IsNullOrEmpty(path)) throw new ArgumentException(nameof(path)); | ||
if (string.IsNullOrEmpty(outputTemplate)) throw new ArgumentException(nameof(outputTemplate)); | ||
bartelink marked this conversation as resolved.
Show resolved
Hide resolved
AraHaan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
var formatter = new MessageTemplateTextFormatter(outputTemplate, formatProvider); | ||
return File(sinkConfiguration, formatter, path, restrictedToMinimumLevel, fileSizeLimitBytes, | ||
|
@@ -337,7 +339,7 @@ public static LoggerConfiguration File( | |
{ | ||
if (sinkConfiguration == null) throw new ArgumentNullException(nameof(sinkConfiguration)); | ||
if (formatter == null) throw new ArgumentNullException(nameof(formatter)); | ||
if (path == null) throw new ArgumentNullException(nameof(path)); | ||
if (string.IsNullOrEmpty(path)) throw new ArgumentException(nameof(path)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this (and equivalents) invalidates the comment (and equivalents):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alright, will fix the comments as soon as possible. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I personally think it would be useful for the existing check and comment to remain as-is for clarity |
||
|
||
return ConfigureFile(sinkConfiguration.Sink, formatter, path, restrictedToMinimumLevel, fileSizeLimitBytes, levelSwitch, | ||
buffered, false, shared, flushToDiskInterval, encoding, rollingInterval, rollOnFileSizeLimit, | ||
|
@@ -449,8 +451,8 @@ public static LoggerConfiguration File( | |
FileLifecycleHooks? hooks = null) | ||
{ | ||
if (sinkConfiguration == null) throw new ArgumentNullException(nameof(sinkConfiguration)); | ||
if (path == null) throw new ArgumentNullException(nameof(path)); | ||
if (outputTemplate == null) throw new ArgumentNullException(nameof(outputTemplate)); | ||
if (string.IsNullOrEmpty(path)) throw new ArgumentException(nameof(path)); | ||
if (string.IsNullOrEmpty(outputTemplate)) throw new ArgumentException(nameof(outputTemplate)); | ||
bartelink marked this conversation as resolved.
Show resolved
Hide resolved
AraHaan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
var formatter = new MessageTemplateTextFormatter(outputTemplate, formatProvider); | ||
return File(sinkConfiguration, formatter, path, restrictedToMinimumLevel, levelSwitch, encoding, hooks); | ||
|
@@ -493,7 +495,7 @@ public static LoggerConfiguration File( | |
{ | ||
if (sinkConfiguration == null) throw new ArgumentNullException(nameof(sinkConfiguration)); | ||
if (formatter == null) throw new ArgumentNullException(nameof(formatter)); | ||
if (path == null) throw new ArgumentNullException(nameof(path)); | ||
if (string.IsNullOrEmpty(path)) throw new ArgumentException(nameof(path)); | ||
|
||
return ConfigureFile(sinkConfiguration.Sink, formatter, path, restrictedToMinimumLevel, null, levelSwitch, false, true, | ||
false, null, encoding, RollingInterval.Infinite, false, null, hooks, null); | ||
|
@@ -519,7 +521,7 @@ static LoggerConfiguration ConfigureFile( | |
{ | ||
if (addSink == null) throw new ArgumentNullException(nameof(addSink)); | ||
if (formatter == null) throw new ArgumentNullException(nameof(formatter)); | ||
if (path == null) throw new ArgumentNullException(nameof(path)); | ||
if (string.IsNullOrEmpty(path)) throw new ArgumentException(nameof(path)); | ||
if (fileSizeLimitBytes.HasValue && fileSizeLimitBytes < 1) throw new ArgumentException("Invalid value provided; file size limit must be at least 1 byte, or null.", nameof(fileSizeLimitBytes)); | ||
if (retainedFileCountLimit.HasValue && retainedFileCountLimit < 1) throw new ArgumentException("At least one file must be retained.", nameof(retainedFileCountLimit)); | ||
if (retainedFileTimeLimit.HasValue && retainedFileTimeLimit < TimeSpan.Zero) throw new ArgumentException("Negative value provided; retained file time limit must be non-negative.", nameof(retainedFileTimeLimit)); | ||
|
Uh oh!
There was an error while loading. Please reload this page.