diff --git a/ExtremelySimpleLogger/LogWriter.cs b/ExtremelySimpleLogger/LogWriter.cs index 6f92ea1..2df4036 100644 --- a/ExtremelySimpleLogger/LogWriter.cs +++ b/ExtremelySimpleLogger/LogWriter.cs @@ -1,11 +1,11 @@ -using System; -using System.IO; +using System.IO; using System.Text; using System.Threading.Tasks; namespace ExtremelySimpleLogger { /// /// Implementation of a that writes to a . + /// The log writer constructs a message based on calls to and its variations and then submits the message to the underlying when or is called. and its variations submit the message immediately. /// public class LogWriter : TextWriter { @@ -59,17 +59,237 @@ namespace ExtremelySimpleLogger { this.line.Append(value); } + /// + public override void Write(char[] buffer) { + lock (this.logger) + this.line.Append(buffer); + } + + /// + public override void Write(bool value) { + lock (this.logger) + this.line.Append(value); + } + + /// + public override void Write(int value) { + lock (this.logger) + this.line.Append(value); + } + + /// + public override void Write(uint value) { + lock (this.logger) + this.line.Append(value); + } + + /// + public override void Write(long value) { + lock (this.logger) + this.line.Append(value); + } + + /// + public override void Write(ulong value) { + lock (this.logger) + this.line.Append(value); + } + + /// + public override void Write(float value) { + lock (this.logger) + this.line.Append(value); + } + + /// + public override void Write(double value) { + lock (this.logger) + this.line.Append(value); + } + + /// + public override void Write(decimal value) { + lock (this.logger) + this.line.Append(value); + } + + /// + public override void Write(object value) { + lock (this.logger) + this.line.Append(value); + } + + /// + public override void Write(string format, object arg0) { + lock (this.logger) + this.line.AppendFormat(this.FormatProvider, format, arg0); + } + + /// + public override void Write(string format, object arg0, object arg1) { + lock (this.logger) + this.line.AppendFormat(this.FormatProvider, format, arg0, arg1); + } + + /// + public override void Write(string format, object arg0, object arg1, object arg2) { + lock (this.logger) + this.line.AppendFormat(this.FormatProvider, format, arg0, arg1, arg2); + } + + /// + public override void Write(string format, params object[] arg) { + lock (this.logger) + this.line.AppendFormat(this.FormatProvider, format, arg); + } + /// public override void WriteLine(string value) { this.Write(value); this.WriteLine(); } + /// + public override void WriteLine(char value) { + this.Write(value); + this.WriteLine(); + } + + /// + public override void WriteLine(char[] buffer) { + this.Write(buffer); + this.WriteLine(); + } + + /// + public override void WriteLine(char[] buffer, int index, int count) { + this.Write(buffer, index, count); + this.WriteLine(); + } + + /// + public override void WriteLine(bool value) { + this.Write(value); + this.WriteLine(); + } + + /// + public override void WriteLine(int value) { + this.Write(value); + this.WriteLine(); + } + + /// + public override void WriteLine(uint value) { + this.Write(value); + this.WriteLine(); + } + + /// + public override void WriteLine(long value) { + this.Write(value); + this.WriteLine(); + } + + /// + public override void WriteLine(ulong value) { + this.Write(value); + this.WriteLine(); + } + + /// + public override void WriteLine(float value) { + this.Write(value); + this.WriteLine(); + } + + /// + public override void WriteLine(double value) { + this.Write(value); + this.WriteLine(); + } + + /// + public override void WriteLine(decimal value) { + this.Write(value); + this.WriteLine(); + } + + /// + public override void WriteLine(object value) { + this.Write(value); + this.WriteLine(); + } + + /// + public override void WriteLine(string format, object arg0) { + this.Write(format, arg0); + this.WriteLine(); + } + + /// + public override void WriteLine(string format, object arg0, object arg1) { + this.Write(format, arg0, arg1); + this.WriteLine(); + } + + /// + public override void WriteLine(string format, object arg0, object arg1, object arg2) { + this.Write(format, arg0, arg1, arg2); + this.WriteLine(); + } + + /// + public override void WriteLine(string format, params object[] arg) { + this.Write(format, arg); + this.WriteLine(); + } + /// public override void WriteLine() { this.Flush(); } + /// + public override Task WriteAsync(char value) { + return Task.Run(() => this.Write(value)); + } + + /// + public override Task WriteAsync(string value) { + return Task.Run(() => this.Write(value)); + } + + /// + public override Task WriteAsync(char[] buffer, int index, int count) { + return Task.Run(() => this.Write(buffer, index, count)); + } + + /// + public override Task WriteLineAsync(char value) { + return Task.Run(() => this.WriteLine(value)); + } + + /// + public override Task WriteLineAsync(string value) { + return Task.Run(() => this.WriteLine(value)); + } + + /// + public override Task WriteLineAsync(char[] buffer, int index, int count) { + return Task.Run(() => this.WriteLine(buffer, index, count)); + } + + /// + public override Task WriteLineAsync() { + return Task.Run(this.WriteLine); + } + + /// + public override Task FlushAsync() { + return Task.Run(this.Flush); + } + /// public override void Flush() { lock (this.logger) {