private static IDictionary <string, TokenHandler <LogEntry> > GetExtraTokenHandlers() { IDictionary <string, TokenHandler <LogEntry> > extraHandlers = new Dictionary <string, TokenHandler <LogEntry> >(); try { // Web Application parameters extraHandlers["namaspace"] = GenericTextFormatter <LogEntry> .CreateSimpleTokenHandler(le => ((WeblogEntry)le).NamespaceName); extraHandlers["className"] = GenericTextFormatter <LogEntry> .CreateSimpleTokenHandler(le => ((WeblogEntry)le).ClassName); extraHandlers["methodSignature"] = GenericTextFormatter <LogEntry> .CreateSimpleTokenHandler(le => ((WeblogEntry)le).MethodSignature); extraHandlers["user"] = GenericTextFormatter <LogEntry> .CreateSimpleTokenHandler(le => ((WeblogEntry)le).CurrentUserName); extraHandlers["ipAddress"] = GenericTextFormatter <LogEntry> .CreateSimpleTokenHandler(le => ((WeblogEntry)le).CurrentUserIPAddress); extraHandlers["userAgent"] = GenericTextFormatter <LogEntry> .CreateSimpleTokenHandler(le => ((WeblogEntry)le).CurrentUserAgent); extraHandlers["url"] = GenericTextFormatter <LogEntry> .CreateSimpleTokenHandler(le => ((WeblogEntry)le).CurrentUrl); extraHandlers["referrer"] = GenericTextFormatter <LogEntry> .CreateSimpleTokenHandler(le => ((WeblogEntry)le).CurrentUrl); } catch (System.Web.HttpException) { } return(extraHandlers); }
private static IDictionary <string, TokenHandler <LogEntry> > GetExtraTokenHandlersDictionary() { Dictionary <string, TokenHandler <LogEntry> > tokenHandlers = new Dictionary <string, TokenHandler <LogEntry> >(); tokenHandlers["field1"] = GenericTextFormatter <LogEntry> .CreateSimpleTokenHandler(le => ((CustomLogEntry)le).AcmeCoField1); tokenHandlers["field2"] = GenericTextFormatter <LogEntry> .CreateSimpleTokenHandler(le => ((CustomLogEntry)le).AcmeCoField2); tokenHandlers["field3"] = GenericTextFormatter <LogEntry> .CreateSimpleTokenHandler(le => ((CustomLogEntry)le).AcmeCoField3); return(tokenHandlers); }