Uploaded image for project: 'Log4net'
  1. Log4net
  2. LOG4NET-358

Visual Studio snippet within the deployment with NuGet

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Resolved
    • Minor
    • Resolution: Won't Fix
    • None
    • None
    • Builds
    • Visual Studio deployment with NuGet

    Description

      The deployment with NuGet for Visual Studio could installs also a snippet which could be used to declare a private static reference to logger "log4net.ILog". So, after installed the log4net via NuGet, we could just go to any class and type log<TAB> and a full and auto declaration appears referencing the enclosure type.

      Following is a snippet I use today with C#, but needs to be installed apart on each Visual Studio installation. The main piece of the snippet is the declaration: private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof($classname$));

      SNIPPET DECLARATION:

      <?xml version="1.0" encoding="utf-8"?>
      <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
      <CodeSnippet Format="1.0.0">
      <Header>
      <SnippetTypes>
      <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
      <Title>log4net - Declaration</Title>
      <Author>Luciano</Author>
      <Description>
      </Description>
      <HelpUrl>
      </HelpUrl>
      <Shortcut>log
      </Shortcut>
      </Header>
      <Snippet>
      <References>
      <Reference>
      <Assembly>log4net.dll</Assembly>
      </Reference>
      </References>
      <Declarations>
      <Literal Editable="true">
      <ID>classname</ID>
      <ToolTip>
      </ToolTip>
      <Function>
      ClassName()
      </Function>
      </Literal>
      </Declarations>
      <Code Language="csharp">
      <![CDATA[private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof($classname$));]]>
      </Code>
      </Snippet>
      </CodeSnippet>
      </CodeSnippets>

      Attachments

        Activity

          People

            Unassigned Unassigned
            lucianomx Luciano
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: