Skip to content
This repository has been archived by the owner on Jun 8, 2019. It is now read-only.

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
jkowalski committed Jan 4, 2005
1 parent d407d27 commit 43de386
Show file tree
Hide file tree
Showing 43 changed files with 1,066 additions and 89 deletions.
16 changes: 13 additions & 3 deletions NLogC.sln
Expand Up @@ -7,10 +7,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NLog", "src\NLog\NLog.cspro
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NLogCTest", "src\NLogCTest\NLogCTest.vcproj", "{3A3B8573-0A64-414D-9E8D-9F1982004299}"
ProjectSection(ProjectDependencies) = postProject
{63966F8B-B3DA-4538-AF36-FCBBFFF67BF7} = {63966F8B-B3DA-4538-AF36-FCBBFFF67BF7}
{020354EE-5073-4BB5-9AA2-A7EADA8CAD09} = {020354EE-5073-4BB5-9AA2-A7EADA8CAD09}
EndProjectSection
EndProject
Global
GlobalSection(DPCodeReviewSolutionGUID) = preSolution
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
EndGlobalSection
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
Expand All @@ -24,9 +27,16 @@ Global
{020354EE-5073-4BB5-9AA2-A7EADA8CAD09}.Debug.Build.0 = Debug|.NET
{020354EE-5073-4BB5-9AA2-A7EADA8CAD09}.Release.ActiveCfg = Release|.NET
{020354EE-5073-4BB5-9AA2-A7EADA8CAD09}.Release.Build.0 = Release|.NET
{3A3B8573-0A64-414D-9E8D-9F1982004299}.Debug.ActiveCfg = Debug|Win32
{3A3B8573-0A64-414D-9E8D-9F1982004299}.Debug.Build.0 = Debug|Win32
{3A3B8573-0A64-414D-9E8D-9F1982004299}.Release.ActiveCfg = Release|Win32
{3A3B8573-0A64-414D-9E8D-9F1982004299}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
GlobalSection(DPCodeReviewSolutionGUID) = preSolution
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
EndGlobalSection
EndGlobal
13 changes: 12 additions & 1 deletion src/NLog.ComInterop/AssemblyInfo.cs
Expand Up @@ -32,9 +32,20 @@
// THE POSSIBILITY OF SUCH DAMAGE.
//

using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("NLog.ComInterop")][assembly: AssemblyDescription("NLog COM Interop")][assembly: AssemblyConfiguration("")][assembly: AssemblyCompany("NLog")][assembly: AssemblyProduct("NLog - .NET Logging Library")][assembly: AssemblyCopyright("Copyright (c) 2004 by Jaroslaw Kowalski")][assembly: AssemblyCulture("")]
[assembly: AssemblyTitle("NLog.ComInterop")]
[assembly: AssemblyDescription("NLog COM Interop")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("NLog")]
[assembly: AssemblyProduct("NLog - .NET Logging Library")]
[assembly: AssemblyCopyright("Copyright (c) 2004 by Jaroslaw Kowalski")]
[assembly: AssemblyCulture("")]

[assembly: AssemblyVersion("0.3.0.0")]

[assembly: Guid("fb84adc2-a04b-4ff3-8a20-7c069c3cfa6f")]

49 changes: 49 additions & 0 deletions src/NLog.ComInterop/ILogManager.cs
@@ -0,0 +1,49 @@
//
// Copyright (c) 2004 Jaroslaw Kowalski <jkowalski@users.sourceforge.net>
//
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * Neither the name of the Jaroslaw Kowalski nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
// THE POSSIBILITY OF SUCH DAMAGE.
//

using System;
using System.Runtime.InteropServices;

namespace NLog.ComInterop
{
[Guid("7ee3af3b-ba37-45b6-8f5d-cc23bb46c698")]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface ILogManager
{
void LoadConfigFromFile(string fileName);
bool InternalLogToConsole { get; set; }
string InternalLogFile { get; set; }
string InternalLogLevel { get; set; }
}
}
8 changes: 8 additions & 0 deletions src/NLog.ComInterop/ILogger.cs
Expand Up @@ -33,9 +33,12 @@
//

using System;
using System.Runtime.InteropServices;

namespace NLog.ComInterop
{
[Guid("757fd55a-cc93-4b53-a7a0-18e85620704a")]
[InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface ILogger
{
void Log(string level, string message);
Expand Down Expand Up @@ -66,5 +69,10 @@ bool IsFatalEnabled
{
get;
}

string LoggerName
{
get; set;
}
}
}
73 changes: 73 additions & 0 deletions src/NLog.ComInterop/LogManager.cs
@@ -0,0 +1,73 @@
//
// Copyright (c) 2004 Jaroslaw Kowalski <jkowalski@users.sourceforge.net>
//
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * Neither the name of the Jaroslaw Kowalski nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
// THE POSSIBILITY OF SUCH DAMAGE.
//

using System;
using System.Runtime.InteropServices;

using NLog;
using NLog.Internal;
using NLog.Config;

namespace NLog.ComInterop
{
[ComVisible(true)]
[ProgId("NLog.LogManager")]
[Guid("9a7e8d84-72e4-478a-9a05-23c7ef0cfca8")]
[ClassInterface(ClassInterfaceType.None)]
public class LogManager: ILogManager
{
public void LoadConfigFromFile(string fileName)
{
NLog.LogManager.Configuration = new XmlLoggingConfiguration(fileName);
}

public bool InternalLogToConsole
{
get { return NLog.Internal.InternalLogger.LogToConsole; }
set { NLog.Internal.InternalLogger.LogToConsole = value; }
}

public string InternalLogLevel
{
get { return NLog.Internal.InternalLogger.LogLevel.ToString(); }
set { NLog.Internal.InternalLogger.LogLevel = NLog.Logger.LogLevelFromString(value); }
}

public string InternalLogFile
{
get { return NLog.Internal.InternalLogger.LogFile; }
set { NLog.Internal.InternalLogger.LogFile = value; }
}
}
}
5 changes: 4 additions & 1 deletion src/NLog.ComInterop/Logger.cs
Expand Up @@ -40,7 +40,10 @@

namespace NLog.ComInterop
{
[ComVisible(true)][ProgId("NLog.Logger")]
[ComVisible(true)]
[ProgId("NLog.Logger")]
[Guid("181f39a8-41a8-4e35-91b6-5f8d96f5e61c")]
[ClassInterface(ClassInterfaceType.None)]
public class Logger: ILogger
{
private static NLog.Logger _defaultLogger = new NullLogger();
Expand Down
14 changes: 12 additions & 2 deletions src/NLog.ComInterop/NLog.ComInterop.csproj
Expand Up @@ -37,7 +37,7 @@
NoWarn = ""
Optimize = "false"
OutputPath = "bin\Debug\"
RegisterForComInterop = "false"
RegisterForComInterop = "true"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "1"
Expand All @@ -57,7 +57,7 @@
NoWarn = ""
Optimize = "false"
OutputPath = "bin\Release\"
RegisterForComInterop = "false"
RegisterForComInterop = "true"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "1"
Expand Down Expand Up @@ -98,11 +98,21 @@
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "ILogManager.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "Logger.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "LogManager.cs"
SubType = "Code"
BuildAction = "Compile"
/>
</Include>
</Files>
</CSHARP>
Expand Down
3 changes: 2 additions & 1 deletion src/NLog.Test/App.config
Expand Up @@ -38,7 +38,8 @@
</appenders>

<rules>
<logger name="*" minlevel="Debug" appendTo="logproc,webproc" />
<logger name="*" minlevel="Debug" appendTo="console,logproc" />
</rules>
</nlog>
</configuration>

5 changes: 3 additions & 2 deletions src/NLog.Test/Test.cs
Expand Up @@ -45,8 +45,8 @@ public static void LogProc(string msg)
}
static void Main(string[]args)
{
Console.WriteLine("zzz");
NLog.LogManager.Configuration = new XmlLoggingConfiguration("NLog.Test.exe.config");
//NLog.LogManager.Configuration = new XmlLoggingConfiguration("NLog.Test.exe.config");
Logger l0 = LogManager.GetCurrentClassLogger();
NLog.Logger l = NLog.LogManager.GetLogger("Aaa");
NLog.Logger l2 = NLog.LogManager.GetLogger("Bbb");

Expand All @@ -73,5 +73,6 @@ static void Main(string[]args)
l.Fatal("this is a fatal");
l2.Error("this is an error");
l2.Fatal("this is a fatal");
l0.Debug("Class logger!");
}
}
6 changes: 3 additions & 3 deletions src/NLog/AssemblyInfo.cs
Expand Up @@ -52,7 +52,7 @@
[assembly: ComVisible(false)]

#if !NETCF
[assembly: ReflectionPermission(SecurityAction.RequestMinimum, MemberAccess = true, TypeInformation = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.Execution)]
[assembly: FileIOPermission(SecurityAction.RequestMinimum, Unrestricted = true)]
//[assembly: ReflectionPermission(SecurityAction.RequestMinimum, MemberAccess = true, TypeInformation = true)]
//[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.Execution)]
//[assembly: FileIOPermission(SecurityAction.RequestMinimum, Unrestricted = true)]
#endif
3 changes: 2 additions & 1 deletion src/NLog/Config/ConfigSectionHandler.cs
Expand Up @@ -37,6 +37,7 @@
using System;
using System.Xml;
using System.Configuration;
using System.IO;

using NLog.Internal;

Expand All @@ -50,7 +51,7 @@ public object Create(object parent, object configContext, XmlNode section)
{
string configFileName = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;

return new XmlLoggingConfiguration(configFileName);
return new XmlLoggingConfiguration((XmlElement)section, configFileName);
}
catch (Exception ex)
{
Expand Down
2 changes: 1 addition & 1 deletion src/NLog/Config/LoggingConfiguration.cs
Expand Up @@ -92,7 +92,7 @@ public virtual ICollection FileNamesToWatch

public virtual LoggingConfiguration Reload()
{
return null;
return this;
}
}
}
11 changes: 11 additions & 0 deletions src/NLog/Config/XmlLoggingConfiguration.cs
Expand Up @@ -69,10 +69,21 @@ public bool AutoReload

public XmlLoggingConfiguration(string fileName)
{
InternalLogger.Info("Configuring from {0}...", fileName);
_originalFileName = fileName;
ConfigureFromFile(fileName);
}

public XmlLoggingConfiguration(XmlElement configElement, string fileName)
{
InternalLogger.Info("Configuring from an XML element in {0}...", fileName);
string key = Path.GetFullPath(fileName).ToLower(CultureInfo.InvariantCulture);
_visitedFile[key] = key;

_originalFileName = fileName;
ConfigureFromXmlElement(configElement, Path.GetDirectoryName(fileName));
}

public override ICollection FileNamesToWatch
{
get
Expand Down

0 comments on commit 43de386

Please sign in to comment.