To setup the component to be used in your own environment, open the file Constants.cs and follow this steps:

1. Set a diagnostics area name

public static readonly string Diagnostics_Area_Name = "IPS";

2. Add your own category names to the CategoryNames enum

public enum CategoryNames
{
      Infomation = 0,
      Warning = 1,
      Error = 2,
      Success = 3
}

3. Add a new category definition to the CustomLogCategories dictionary for each category name added in the previous step

public static readonly Dictionary<int, CustomLogCategory> CustomLogCategories = new Dictionary<int, CustomLogCategory>()
{
      {0, new CustomLogCategory () {Id = 0, Name = Enum.GetName(typeof(CategoryNames), CategoryNames.Infomation), TraceSeverity = TraceSeverity.Medium, EventSeverity= EventSeverity.Information } },
      {1, new CustomLogCategory () {Id = 0, Name= Enum.GetName(typeof(CategoryNames), CategoryNames.Warning), TraceSeverity = TraceSeverity.High, EventSeverity= EventSeverity.Warning } },
      {2, new CustomLogCategory () {Id = 0, Name= Enum.GetName(typeof(CategoryNames), CategoryNames.Error), TraceSeverity = TraceSeverity.Unexpected, EventSeverity= EventSeverity.Error } },
      {3, new CustomLogCategory () {Id = 0, Name= Enum.GetName(typeof(CategoryNames), CategoryNames.Success), TraceSeverity = TraceSeverity.Verbose, EventSeverity= EventSeverity.Verbose } }
};


EXAMPLE OF USE:

1.- Add a reference to IPS.SP2013.DiagnosticsProvider.dll

2.- Add using statement

using IPS.SP2013.DiagnosticsProvider;

3.- Example

    try
    {
    }
    catch (Exception)
    {
        LogProvider.WriteLogEntry(IPS.SP2013.DiagnosticsProvider.Constants.CategoryNames.Error,
                                "Error Activating Feature: IPS.SP2013.CustomLoginPage (Scope: WebApplication)");
        return;
    }

Last edited Jan 18, 2014 at 4:53 PM by iparedes, version 10