|
<?xml version="1.0" encoding="windows-1250" ?>
<?xml-stylesheet type="text/xsl" href="style.xsl" ?>
<content lang="en" id="api" subid="comapi">
<h1>COM API</h1>
<p>
NLog features a COM Interop API tha can be used to provide logging for legacy COM applications/components that
are deployed as part of a .NET solution. COM support is available with 2 coclasses with ProgIDs: <code>NLog.LogManager</code>
which lets you perform basic configuration and <code>NLog.Logger</code> which does the actual logging.
</p>
<p>
COM components are supported for many languages, both scripting and compiled. Basic usage is
similar to the .NET API, with the following exceptions:
</p>
<ul>
<li>Instances of loggers are created directly, you don't need to use LogManager to get them.</li>
<li>Because COM classes don't support passing parameters at construction time, you need to set
each logger's name by setting its <code>LoggerName</code></li>
<li>Passing of format arguments isn't supported</li>
<li>Logger levels (arguments to the <code>Log()</code> method) are passed as strings instead of enumeration values - this provides maximum compatibility
with scripting environments.</li>
</ul>
<p>
The following example demonstrates the use of NLog COM api for JScript.
</p>
<js src="examples/test.js" />
</content>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.