Ejemplo n.º 1
0
        public ConsoleLog(ConsoleLogTarget target, Encoding encoding, int bufferSize, ConsoleLogStyle defaultStyle)
        {
            if (!target.IsValid())
            {
                throw new ArgumentOutOfRangeException(nameof(target));
            }

            if (encoding == null)
            {
                throw new ArgumentNullException(nameof(encoding));
            }

            if (bufferSize < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(bufferSize));
            }

            Stream tempStream = null;

            try
            {
                tempStream = OpenStandardStream(target, bufferSize);
                writer     = new StreamWriter(tempStream, encoding, bufferSize);
                tempStream = null;
            }
            finally
            {
                tempStream?.Close();
            }

            this.defaultStyle = defaultStyle;
        }
Ejemplo n.º 2
0
 public ConsoleLog(ConsoleLogTarget target, Encoding encoding, ConsoleLogStyle defaultStyle)
     : this(target, encoding, DefaultBufferSize, defaultStyle)
 {
 }
Ejemplo n.º 3
0
 public ConsoleLog(ConsoleLogStyle defaultStyle)
     : this(ConsoleLogTarget.Out, Console.OutputEncoding, DefaultBufferSize, defaultStyle)
 {
 }