maoyuan121 / elmah

Automatically exported from code.google.com/p/elmah
Apache License 2.0
0 stars 0 forks source link

Easy out of the box signal "logger" for elmah #267

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Although the error signal is easy enough, but I want something much simpler and 
cleaner, therefore I created this static class for my project, see if it is 
useful to put in to the .dll for some simple logging requirement. I was 
creating this for some logging and testing in production environment where VS 
debugger could not be applied.

-----------------------

namespace Elmah
{
    public static class SimpleLogger
    {
        public static void log(string errorMsg)
        {
            ErrorSignal.FromCurrentContext().Raise(new ElmahInfoLog(errorMsg));
        }
    }

    public class ElmahInfoLog : NotSupportedException
    {
        public ElmahInfoLog(string message) : base(message) { }
    }
}

---------------------

usage : 

Elmah.SimpleLogger("this is a log message");

Original issue reported on code.google.com by data...@gmail.com on 9 Jan 2012 at 4:27