Loupe - Log - Monitor - Resolve
Loupe / Getting Started / Getting Started - Adding Loupe to your Application
In This Topic
    Getting Started - Adding Loupe to your Application
    In This Topic

    The first step in using Loupe to monitor an application is to add the Loupe Agent to it and configure how you want it to collect data.  The Loupe Agent can be found on NuGet.  While Loupe can perform basic monitoring of any .NET application, it is designed to work with common existing diagnostic systems such as the Trace and Debug logging built into the .NET framework.  To get more out of Loupe you can work directly with the Loupe API to record information, or use your favorite logging system - Integration with several systems is available out of the box.

     Configuring Loupe in your Config File

    You can add the Loupe Agent to an existing application by registering it in the App.Config (web.config for web sites) file.  Each application can have a configuration file that is used to hold options that can be changed without recompiling the application.  These options apply to all users of the application. 

     Configuring Loupe through Code

    All of the configuration steps necessary to use Loupe can be done using the Loupe Configuration API.  This is particularly appealing when you don't otherwise need a configuration file. 

     Add Logging and Metrics to your Application Without Code

    Loupe includes a library of aspects that can quickly add additional logging to your applications without adding source code.  With the Loupe Agent for PostSharp you can declaratively add Loupe logging to your programs by simply tagging whatever methods, classes or assemblies you wish.  This lets you add powerful logging features quickly without the effort of writing procedural logging code and without having to learn the Loupe API. 

    To find out how you can add extensive instrumentation to your application in minutes, see Third Party Integration - Using PostSharp with Loupe.  The best part?  It's free and in the box.

    What's Next?

    As soon as it's integrated, you can see log messages while your application is running by using the Loupe Live Viewer.  Just press the application-wide hot key (Control-Alt-F5 by default) and a window will pop up with the last 10,000 messages that have been recorded by Loupe.  The behavior of the Live Viewer can be extensively customized by making entries in the App.Config file, just see Developer's Reference - Agent Configuration.

    If your application is not currently using another logging system you should try logging directly to the Loupe API.  This has several advantages:

    1. No configuration file changes required:  Everything can be done in your code without changing your App.Config file, including configuring the agent. See Developer's Reference - Agent Configuration through Code.
    2. Additional Features with the least complexity:  The Loupe API is designed to be compatible with several log systems but also provides a simple API you can use directly that provides access to all of the Loupe features without the limitations of a separate log system. 
    3. Lowest complexity:  You will not need to configure and deploy a separate log system in addition to the Loupe agent and your application.  Because a direct reference will exist between your code and the Loupe agent a setup wizard will automatically include the agent library.

    To do this, you will need to add a reference to the Loupe Agent (Gibraltar.Agent.dll) in any project that will write log messages and add the appropriate calls to the Gibraltar.Agent.Log object.  The Loupe Agent is available on NuGet.

    For quick guidance and best practices on how to directly use the Loupe API to log, see Developer's Reference - Logging - Directly to Loupe .

    See Also