Skip to content

appharbor/ConsoleMirror

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ConsoleMirror by AppHarbor

ConsoleMirror is a simple utility that allows you to capture the console output of Console.Write() and Console.WriteLine() calls within your .NET console applications.

Installation

ConsoleMirror is available on NuGet and works on .NET 2.0+

Sample usage

    using System;
    using NLog;

    namespace WorkerDemo
    {
        class Program
        {
            private static Logger logger = LogManager.GetCurrentClassLogger();
            static void Main(string[] args)
            {
                ConsoleMirror.Initialize();

                try
                {
                    Console.WriteLine("Hello world!");
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    Console.WriteLine(ex.StackTrace);
                }

                logger.Info(ConsoleMirror.Captured);
            }
        }
    }

The output is both captured into ConsoleMirror.Captured as well as displayed on the screen.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages