/ Published in: C#
Modify as neccesary, add more areas.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public class LoggingService : SPDiagnosticsServiceBase { public static string MaventionDiagnosticAreaName = "Truck Seach"; private static LoggingService _Current; public static LoggingService Current { get { if (_Current == null) { } return _Current; } } private LoggingService() : base("My Solution Logging Service", SPFarm.Local) { } protected override IEnumerable<SPDiagnosticsArea> ProvideAreas() { { { new SPDiagnosticsCategory("Truck Search Copy Pictures", TraceSeverity.Verbose, EventSeverity.Information) }) }; return areas; } public static void LogError(string categoryName, string Message) { SPDiagnosticsCategory category = LoggingService.Current.Areas[MaventionDiagnosticAreaName].Categories[categoryName]; LoggingService.Current.WriteTrace(0, category, TraceSeverity.Verbose, Message); } }