#region Copyright & License
//
// Copyright 2001-2005 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion
// MONO 1.0 has no support for Win32 OutputDebugString API
#if !MONO
// SSCLI 1.0 has no support for Win32 OutputDebugString API
#if !SSCLI
// We don't want framework or platform specific code in the CLI version of log4net
#if !CLI_1_0
using System.Runtime.InteropServices;
using log4net.Layout;
using log4net.Core;
namespace log4net.Appender
{
///
/// Appends log events to the OutputDebugString system.
///
///
///
/// OutputDebugStringAppender appends log events to the
/// OutputDebugString system.
///
///
/// The string is passed to the native OutputDebugString
/// function.
///
///
/// Nicko Cadell
/// Gert Driesen
public class OutputDebugStringAppender : AppenderSkeleton
{
#region Public Instance Constructors
///
/// Initializes a new instance of the class.
///
///
///
/// Default constructor.
///
///
public OutputDebugStringAppender()
{
}
#endregion // Public Instance Constructors
#region Override implementation of AppenderSkeleton
///
/// Write the logging event to the output debug string API
///
/// the event to log
///
///
/// Write the logging event to the output debug string API
///
///
override protected void Append(LoggingEvent loggingEvent)
{
OutputDebugString(RenderLoggingEvent(loggingEvent));
}
///
/// This appender requires a to be set.
///
/// true
///
///
/// This appender requires a to be set.
///
///
override protected bool RequiresLayout
{
get { return true; }
}
#endregion // Override implementation of AppenderSkeleton
#region Protected Static Methods
///
/// Stub for OutputDebugString native method
///
/// the string to output
///
///
/// Stub for OutputDebugString native method
///
///
#if NETCF
[DllImport("CoreDll.dll")]
#else
[DllImport("Kernel32.dll")]
#endif
protected static extern void OutputDebugString(string message);
#endregion // Protected Static Methods
}
}
#endif // !CLI_1_0
#endif // !SSCLI
#endif // !MONO