public async Task <IList <AuditLogEntry> > GetAuditLogs(int skip = 0, int take = 100) { IList <AuditLogEntry> logs = null; var logger = SkServiceLocator.Get <SkLoggerBase>() as SkDbLogger; if (logger != null) { logs = await logger.GetAuditLogs(); } return(logs); }
public async Task <ActionResult> AuditLogMvc() { ViewBag.Message = "Audit Log with MVC"; IList <AuditLogEntry> logs = null; var logger = SkServiceLocator.Get <SkLoggerBase>() as SkDbLogger; if (logger != null) { logs = await logger.GetAuditLogs(); } return(View(logs)); }
private static void HandleExceptioin(Exception ex, SkExceptionHandleAction action) { //No action if (action == SkExceptionHandleAction.None) { return; } //log exception if (action == SkExceptionHandleAction.LogAndRethrow) { var logger = SkServiceLocator.Get <SkLoggerBase>(); if (logger != null) { logger.LogError(ex); } } // throw current exception if (action == SkExceptionHandleAction.Rethrow || action == SkExceptionHandleAction.LogAndRethrow) { throw ex; } }
public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext) { var logger = SkServiceLocator.Get <SkLoggerBase>(); logger.LogAudit(_eventName, _detail, _properties); }
public static void Initialize() { // Register Logger SkServiceLocator.Register <SkLoggerBase>(new SkDbLogger()); }