mirror of
https://github.com/Ellpeck/ExtremelySimpleLogger.git
synced 2024-11-24 18:48:34 +01:00
expose the string sink's string builder
This commit is contained in:
parent
46bb08f60b
commit
5ab6fd855e
1 changed files with 13 additions and 2 deletions
|
@ -7,9 +7,8 @@ namespace ExtremelySimpleLogger {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class StringSink : Sink {
|
public class StringSink : Sink {
|
||||||
|
|
||||||
private readonly StringBuilder builder = new StringBuilder();
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The string that this sink currently contains.
|
/// The string that this sink currently contains, constructed from the underlying <see cref="StringBuilder"/>.
|
||||||
/// Can be cleared using <see cref="Clear"/>.
|
/// Can be cleared using <see cref="Clear"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Value {
|
public string Value {
|
||||||
|
@ -18,6 +17,18 @@ namespace ExtremelySimpleLogger {
|
||||||
return this.builder.ToString();
|
return this.builder.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="StringBuilder"/> used to collect logged data from this sink.
|
||||||
|
/// To get its value directly, you can use <see cref="Value"/>.
|
||||||
|
/// </summary>
|
||||||
|
public StringBuilder StringBuilder {
|
||||||
|
get {
|
||||||
|
lock (this.builder)
|
||||||
|
return this.builder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logs the given message, which has already been formatted using <see cref="Sink.Formatter"/>.
|
/// Logs the given message, which has already been formatted using <see cref="Sink.Formatter"/>.
|
||||||
|
|
Loading…
Reference in a new issue