Code Monkey home page Code Monkey logo

spiffy's Introduction

Spiffy

A monitoring framework for .NET that supports IoC and modern targets, e.g. Splunk

Setup

PM> Install-Package Spiffy.Monitoring.NLog

Example

        static void Main()
        {
            // this should be the first line of your application
            NLog.Initialize();

            // key-value-pairs set here appear in every event message
            GlobalEventContext.Instance
                .Set("Application", "TestConsole");

            using (var context = new EventContext())
            {
                context["MyCustomValue"] = "foo";

                using (context.Time("LongRunning"))
                {
                    DoSomethingLongRunning();
                }

                try
                {
                    DoSomethingDangerous();
                }
                catch (Exception ex)
                {
                    context.IncludeException(ex);
                }
            }
        }

Normal Entry

[2014-06-13 00:05:17.634Z] Application=TestConsole Level=Info Component=Program Operation=Main TimeElapsed=1004.2 MyCustomValue=foo TimeElapsed_LongRunning=1000.2

Exception Entry

[2014-06-13 00:12:52.038Z] Application=TestConsole Level=Error Component=Program Operation=Main TimeElapsed=1027.0 MyCustomValue=foo ErrorReason="An exception has ocurred" Exception_Type=ApplicationException Exception_Message="you were unlucky!" Exception_StackTrace=" at TestConsoleApp.Program.DoSomethingDangerous() in c:\src\git\github\chris-peterson\Spiffy\src\Tests\TestConsoleApp\Program.cs:line 47 at TestConsoleApp.Program.Main() in c:\src\git\github\chris-peterson\Spiffy\src\Tests\TestConsoleApp\Program.cs:line 29" InnermostException_Type=NullReferenceException InnermostException_Message="Object reference not set to an instance of an object." InnermostException_StackTrace={null} Exception="See Exception_* and InnermostException_* for more details" TimeElapsed_LongRunning=1000.0

spiffy's People

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.