andrew4582

ah_log4netExtentions.snippet

Mar 5th, 2011
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.88 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  3.     <CodeSnippet Format="1.0.0">
  4.         <Header>
  5.             <Title>ahlog4net_Extentions</Title>
  6.             <Shortcut>ahlog4net_Extentions</Shortcut>
  7.             <Description>Code snippet created on: 7/9/2009 1:44:00 PM</Description>
  8.             <Author>Andrew Hodgson</Author>
  9.             <SnippetTypes>
  10.                 <SnippetType>Expansion</SnippetType>
  11.             </SnippetTypes>
  12.         </Header>
  13.         <Snippet>
  14.             <Declarations>
  15.                 <Literal>
  16.                     <ID>type</ID>
  17.                     <ToolTip>Property type</ToolTip>
  18.                     <Default>string</Default>
  19.                 </Literal>
  20.                 <Literal>
  21.                     <ID>property</ID>
  22.                     <ToolTip>Property name</ToolTip>
  23.                     <Default>MyProperty</Default>
  24.                 </Literal>
  25.             </Declarations>
  26.             <Code Language="csharp">
  27.                 <![CDATA[
  28.     #region log4net Extensions class
  29.  
  30.     public static class ILogExtentions {
  31.  
  32.         public static void Debug(this log4net.ILog log,string format,params object[] args) {
  33.             if(log.IsDebugEnabled)
  34.                 log.DebugFormat(format,args);
  35.         }
  36.         public static void Info(this log4net.ILog log,string format,params object[] args) {
  37.             if(log.IsInfoEnabled)
  38.                 log.InfoFormat(format,args);
  39.         }
  40.         public static void Warn(this log4net.ILog log,string format,params object[] args) {
  41.             if(log.IsWarnEnabled)
  42.                 log.WarnFormat(format,args);
  43.         }
  44.         public static void Error(this log4net.ILog log,string format,params object[] args) {
  45.             if(log.IsErrorEnabled)
  46.                 log.ErrorFormat(format,args);
  47.         }
  48.         public static void Fatal(this log4net.ILog log,string format,params object[] args) {
  49.             if(log.IsFatalEnabled)
  50.                 log.FatalFormat(format,args);
  51.         }
  52.     }
  53.  
  54.     #endregion
  55.     $end$]]>
  56.             </Code>
  57.         </Snippet>
  58.     </CodeSnippet>
  59. </CodeSnippets>
Advertisement
Add Comment
Please, Sign In to add comment