Skip to content

Commit 512587f

Browse files
authored
Merge pull request serilog#167 from rafaelsc/feature/improveDocumentation
Improves XML documentation
2 parents 455c32c + e44e591 commit 512587f

File tree

5 files changed

+80
-1
lines changed

5 files changed

+80
-1
lines changed

src/Serilog.Sinks.File/FileLoggerConfigurationExtensions.cs

+54
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
using System;
1616
using System.ComponentModel;
17+
using System.IO;
1718
using System.Text;
1819
using Serilog.Configuration;
1920
using Serilog.Core;
@@ -238,6 +239,15 @@ public static LoggerConfiguration File(
238239
/// Ignored if <paramref see="rollingInterval"/> is <see cref="RollingInterval.Infinite"/>.
239240
/// The default is to retain files indefinitely.</param>
240241
/// <returns>Configuration object allowing method chaining.</returns>
242+
/// <exception cref="ArgumentNullException">When <paramref name="sinkConfiguration"/> is <code>null</code></exception>
243+
/// <exception cref="ArgumentNullException">When <paramref name="path"/> is <code>null</code></exception>
244+
/// <exception cref="ArgumentNullException">When <paramref name="outputTemplate"/> is <code>null</code></exception>
245+
/// <exception cref="IOException"></exception>
246+
/// <exception cref="InvalidOperationException"></exception>
247+
/// <exception cref="NotSupportedException"></exception>
248+
/// <exception cref="PathTooLongException">When <paramref name="path"/> is too long</exception>
249+
/// <exception cref="UnauthorizedAccessException">The caller does not have the required permission to access the <paramref name="path"/></exception>
250+
/// <exception cref="ArgumentException">Invalid <paramref name="path"/></exception>
241251
public static LoggerConfiguration File(
242252
this LoggerSinkConfiguration sinkConfiguration,
243253
string path,
@@ -299,6 +309,15 @@ public static LoggerConfiguration File(
299309
/// Ignored if <paramref see="rollingInterval"/> is <see cref="RollingInterval.Infinite"/>.
300310
/// The default is to retain files indefinitely.</param>
301311
/// <returns>Configuration object allowing method chaining.</returns>
312+
/// <exception cref="ArgumentNullException">When <paramref name="sinkConfiguration"/> is <code>null</code></exception>
313+
/// <exception cref="ArgumentNullException">When <paramref name="formatter"/> is <code>null</code></exception>
314+
/// <exception cref="ArgumentNullException">When <paramref name="path"/> is <code>null</code></exception>
315+
/// <exception cref="IOException"></exception>
316+
/// <exception cref="InvalidOperationException"></exception>
317+
/// <exception cref="NotSupportedException"></exception>
318+
/// <exception cref="PathTooLongException">When <paramref name="path"/> is too long</exception>
319+
/// <exception cref="UnauthorizedAccessException">The caller does not have the required permission to access the <paramref name="path"/></exception>
320+
/// <exception cref="ArgumentException">Invalid <paramref name="path"/></exception>
302321
public static LoggerConfiguration File(
303322
this LoggerSinkConfiguration sinkConfiguration,
304323
ITextFormatter formatter,
@@ -339,6 +358,14 @@ public static LoggerConfiguration File(
339358
/// the default is "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level:u3}] {Message:lj}{NewLine}{Exception}".</param>
340359
/// <returns>Configuration object allowing method chaining.</returns>
341360
/// <remarks>The file will be written using the UTF-8 character set.</remarks>
361+
/// <exception cref="ArgumentNullException">When <paramref name="sinkConfiguration"/> is <code>null</code></exception>
362+
/// <exception cref="ArgumentNullException">When <paramref name="path"/> is <code>null</code></exception>
363+
/// <exception cref="IOException"></exception>
364+
/// <exception cref="InvalidOperationException"></exception>
365+
/// <exception cref="NotSupportedException"></exception>
366+
/// <exception cref="PathTooLongException">When <paramref name="path"/> is too long</exception>
367+
/// <exception cref="UnauthorizedAccessException">The caller does not have the required permission to access the <paramref name="path"/></exception>
368+
/// <exception cref="ArgumentException">Invalid <paramref name="path"/></exception>
342369
[Obsolete("New code should not be compiled against this obsolete overload"), EditorBrowsable(EditorBrowsableState.Never)]
343370
public static LoggerConfiguration File(
344371
this LoggerAuditSinkConfiguration sinkConfiguration,
@@ -367,6 +394,15 @@ public static LoggerConfiguration File(
367394
/// to be changed at runtime.</param>
368395
/// <returns>Configuration object allowing method chaining.</returns>
369396
/// <remarks>The file will be written using the UTF-8 character set.</remarks>
397+
/// <exception cref="ArgumentNullException">When <paramref name="sinkConfiguration"/> is <code>null</code></exception>
398+
/// <exception cref="ArgumentNullException">When <paramref name="formatter"/> is <code>null</code></exception>
399+
/// <exception cref="ArgumentNullException">When <paramref name="path"/> is <code>null</code></exception>
400+
/// <exception cref="IOException"></exception>
401+
/// <exception cref="InvalidOperationException"></exception>
402+
/// <exception cref="NotSupportedException"></exception>
403+
/// <exception cref="PathTooLongException">When <paramref name="path"/> is too long</exception>
404+
/// <exception cref="UnauthorizedAccessException">The caller does not have the required permission to access the <paramref name="path"/></exception>
405+
/// <exception cref="ArgumentException">Invalid <paramref name="path"/></exception>
370406
[Obsolete("New code should not be compiled against this obsolete overload"), EditorBrowsable(EditorBrowsableState.Never)]
371407
public static LoggerConfiguration File(
372408
this LoggerAuditSinkConfiguration sinkConfiguration,
@@ -393,6 +429,15 @@ public static LoggerConfiguration File(
393429
/// <param name="encoding">Character encoding used to write the text file. The default is UTF-8 without BOM.</param>
394430
/// <param name="hooks">Optionally enables hooking into log file lifecycle events.</param>
395431
/// <returns>Configuration object allowing method chaining.</returns>
432+
/// <exception cref="ArgumentNullException">When <paramref name="sinkConfiguration"/> is <code>null</code></exception>
433+
/// <exception cref="ArgumentNullException">When <paramref name="path"/> is <code>null</code></exception>
434+
/// <exception cref="ArgumentNullException">When <paramref name="outputTemplate"/> is <code>null</code></exception>
435+
/// <exception cref="IOException"></exception>
436+
/// <exception cref="InvalidOperationException"></exception>
437+
/// <exception cref="NotSupportedException"></exception>
438+
/// <exception cref="PathTooLongException">When <paramref name="path"/> is too long</exception>
439+
/// <exception cref="UnauthorizedAccessException">The caller does not have the required permission to access the <paramref name="path"/></exception>
440+
/// <exception cref="ArgumentException">Invalid <paramref name="path"/></exception>
396441
public static LoggerConfiguration File(
397442
this LoggerAuditSinkConfiguration sinkConfiguration,
398443
string path,
@@ -428,6 +473,15 @@ public static LoggerConfiguration File(
428473
/// <param name="encoding">Character encoding used to write the text file. The default is UTF-8 without BOM.</param>
429474
/// <param name="hooks">Optionally enables hooking into log file lifecycle events.</param>
430475
/// <returns>Configuration object allowing method chaining.</returns>
476+
/// <exception cref="ArgumentNullException">When <paramref name="sinkConfiguration"/> is <code>null</code></exception>
477+
/// <exception cref="ArgumentNullException">When <paramref name="formatter"/> is <code>null</code></exception>
478+
/// <exception cref="ArgumentNullException">When <paramref name="path"/> is <code>null</code></exception>
479+
/// <exception cref="IOException"></exception>
480+
/// <exception cref="InvalidOperationException"></exception>
481+
/// <exception cref="NotSupportedException"></exception>
482+
/// <exception cref="PathTooLongException">When <paramref name="path"/> is too long</exception>
483+
/// <exception cref="UnauthorizedAccessException">The caller does not have the required permission to access the <paramref name="path"/></exception>
484+
/// <exception cref="ArgumentException">Invalid <paramref name="path"/></exception>
431485
public static LoggerConfiguration File(
432486
this LoggerAuditSinkConfiguration sinkConfiguration,
433487
ITextFormatter formatter,

src/Serilog.Sinks.File/Sinks/File/FileSink.cs

+9
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,15 @@ public sealed class FileSink : IFileSink, IDisposable
4444
/// is false.</param>
4545
/// <returns>Configuration object allowing method chaining.</returns>
4646
/// <remarks>This constructor preserves compatibility with early versions of the public API. New code should not depend on this type.</remarks>
47+
/// <exception cref="ArgumentNullException">When <paramref name="textFormatter"/> is <code>null</code></exception>
48+
/// <exception cref="ArgumentException">When <paramref name="fileSizeLimitBytes"/> is <code>null</code> or less than <code>0</code></exception>
49+
/// <exception cref="ArgumentNullException">When <paramref name="path"/> is <code>null</code></exception>
4750
/// <exception cref="IOException"></exception>
51+
/// <exception cref="InvalidOperationException"></exception>
52+
/// <exception cref="NotSupportedException"></exception>
53+
/// <exception cref="PathTooLongException">When <paramref name="path"/> is too long</exception>
54+
/// <exception cref="UnauthorizedAccessException">The caller does not have the required permission to access the <paramref name="path"/></exception>
55+
/// <exception cref="ArgumentException">Invalid <paramref name="path"/></exception>
4856
[Obsolete("This type and constructor will be removed from the public API in a future version; use `WriteTo.File()` instead.")]
4957
public FileSink(string path, ITextFormatter textFormatter, long? fileSizeLimitBytes, Encoding encoding = null, bool buffered = false)
5058
: this(path, textFormatter, fileSizeLimitBytes, encoding, buffered, null)
@@ -113,6 +121,7 @@ bool IFileSink.EmitOrOverflow(LogEvent logEvent)
113121
/// Emit the provided log event to the sink.
114122
/// </summary>
115123
/// <param name="logEvent">The log event to write.</param>
124+
/// <exception cref="ArgumentNullException">When <paramref name="logEvent"/> is <code>null</code></exception>
116125
public void Emit(LogEvent logEvent)
117126
{
118127
((IFileSink) this).EmitOrOverflow(logEvent);

src/Serilog.Sinks.File/Sinks/File/PeriodicFlushToDiskSink.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class PeriodicFlushToDiskSink : ILogEventSink, IDisposable
3636
/// </summary>
3737
/// <param name="sink">The sink to wrap.</param>
3838
/// <param name="flushInterval">The interval at which to flush the underlying sink.</param>
39-
/// <exception cref="ArgumentNullException"/>
39+
/// <exception cref="ArgumentNullException">When <paramref name="sink"/> is <code>null</code></exception>
4040
public PeriodicFlushToDiskSink(ILogEventSink sink, TimeSpan flushInterval)
4141
{
4242
_sink = sink ?? throw new ArgumentNullException(nameof(sink));

src/Serilog.Sinks.File/Sinks/File/SharedFileSink.AtomicAppend.cs

+8
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,14 @@ public sealed class SharedFileSink : IFileSink, IDisposable
5050
/// will be written in full even if it exceeds the limit.</param>
5151
/// <param name="encoding">Character encoding used to write the text file. The default is UTF-8 without BOM.</param>
5252
/// <returns>Configuration object allowing method chaining.</returns>
53+
/// <exception cref="ArgumentNullException">When <paramref name="path"/> is <code>null</code></exception>
54+
/// <exception cref="ArgumentNullException">When <paramref name="textFormatter"/> is <code>null</code></exception>
5355
/// <exception cref="IOException"></exception>
56+
/// <exception cref="InvalidOperationException"></exception>
57+
/// <exception cref="NotSupportedException"></exception>
58+
/// <exception cref="PathTooLongException">When <paramref name="path"/> is too long</exception>
59+
/// <exception cref="UnauthorizedAccessException">The caller does not have the required permission to access the <paramref name="path"/></exception>
60+
/// <exception cref="ArgumentException">Invalid <paramref name="path"/></exception>
5461
public SharedFileSink(string path, ITextFormatter textFormatter, long? fileSizeLimitBytes, Encoding encoding = null)
5562
{
5663
if (fileSizeLimitBytes.HasValue && fileSizeLimitBytes < 1)
@@ -141,6 +148,7 @@ bool IFileSink.EmitOrOverflow(LogEvent logEvent)
141148
/// Emit the provided log event to the sink.
142149
/// </summary>
143150
/// <param name="logEvent">The log event to write.</param>
151+
/// <exception cref="ArgumentNullException">When <paramref name="logEvent"/> is <code>null</code></exception>
144152
public void Emit(LogEvent logEvent)
145153
{
146154
((IFileSink)this).EmitOrOverflow(logEvent);

src/Serilog.Sinks.File/Sinks/File/SharedFileSink.OSMutex.cs

+8
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,14 @@ public sealed class SharedFileSink : IFileSink, IDisposable
4949
/// <param name="encoding">Character encoding used to write the text file. The default is UTF-8 without BOM.</param>
5050
/// <returns>Configuration object allowing method chaining.</returns>
5151
/// <remarks>The file will be written using the UTF-8 character set.</remarks>
52+
/// <exception cref="ArgumentNullException">When <paramref name="path"/> is <code>null</code></exception>
53+
/// <exception cref="ArgumentNullException">When <paramref name="textFormatter"/> is <code>null</code></exception>
5254
/// <exception cref="IOException"></exception>
55+
/// <exception cref="InvalidOperationException"></exception>
56+
/// <exception cref="NotSupportedException"></exception>
57+
/// <exception cref="PathTooLongException">When <paramref name="path"/> is too long</exception>
58+
/// <exception cref="UnauthorizedAccessException">The caller does not have the required permission to access the <paramref name="path"/></exception>
59+
/// <exception cref="ArgumentException">Invalid <paramref name="path"/></exception>
5360
public SharedFileSink(string path, ITextFormatter textFormatter, long? fileSizeLimitBytes, Encoding encoding = null)
5461
{
5562
if (path == null) throw new ArgumentNullException(nameof(path));
@@ -104,6 +111,7 @@ bool IFileSink.EmitOrOverflow(LogEvent logEvent)
104111
/// Emit the provided log event to the sink.
105112
/// </summary>
106113
/// <param name="logEvent">The log event to write.</param>
114+
/// <exception cref="ArgumentNullException">When <paramref name="logEvent"/> is <code>null</code></exception>
107115
public void Emit(LogEvent logEvent)
108116
{
109117
((IFileSink)this).EmitOrOverflow(logEvent);

0 commit comments

Comments
 (0)