diff --git a/src/MarkPad/AppBootstrapper.cs b/src/MarkPad/AppBootstrapper.cs index 7ec399c4..0bc27e5c 100644 --- a/src/MarkPad/AppBootstrapper.cs +++ b/src/MarkPad/AppBootstrapper.cs @@ -38,8 +38,9 @@ private static void SetupLogging() protected override void Configure() { SetupLogging(); - - Caliburn.Micro.LogManager.GetLog = t => new NLogAdapter(t); + // DTB: replaced use of internal NLogAdapter to the one provided by Caliburn.Micro.Logging + Caliburn.Micro.LogManager.GetLog = t => new Caliburn.Micro.Logging.NLog.NLogLogger(t); + //Caliburn.Micro.LogManager.GetLog = t => new NLogAdapter(t); var builder = new ContainerBuilder(); diff --git a/src/MarkPad/Caliburn/Micro/Logging/DebugLogger.cs b/src/MarkPad/Caliburn/Micro/Logging/DebugLogger.cs new file mode 100644 index 00000000..a0aa5877 --- /dev/null +++ b/src/MarkPad/Caliburn/Micro/Logging/DebugLogger.cs @@ -0,0 +1,85 @@ +using System; +using System.Diagnostics; + +namespace Caliburn.Micro.Logging +{ + /// + /// Implementation of the ILog and ILogExtended interfaces using + /// . + /// + public class DebugLogger : ILog, ILogExtended + { + #region Constants + private const string ErrorText = "ERROR"; + private const string WarnText = "WARN"; + private const string InfoText = "INFO"; + #endregion + + #region Fields + private readonly Type _type; + #endregion + + #region Constructors + public DebugLogger(Type type) + { + _type = type; + } + #endregion + + #region Helper Methods + private string CreateLogMessage(string format, params object[] args) + { + return string.Format("[{0}] {1}", DateTime.Now.ToString("o"), string.Format(format, args)); + } + #endregion + + #region ILog Members + /// + /// Logs the exception. + /// + /// The exception. + public void Error(Exception exception) + { + Debug.WriteLine(CreateLogMessage(exception.ToString()), ErrorText); + } + /// + /// Logs the message as info. + /// + /// A formatted message.Parameters to be injected into the formatted message. + public void Info(string format, params object[] args) + { + Debug.WriteLine(CreateLogMessage(format, args), InfoText); + } + /// + /// Logs the message as a warning. + /// + /// A formatted message.Parameters to be injected into the formatted message. + public void Warn(string format, params object[] args) + { + Debug.WriteLine(CreateLogMessage(format, args), WarnText); + } + #endregion + + #region Implementation of ILogExtended + /// + /// Logs the message as error. + /// + /// A formatted message. + /// Parameters to be injected into the formatted message. + public void Error(string format, params object[] args) + { + Debug.WriteLine(CreateLogMessage(format, args), ErrorText); + } + /// + /// Logs the exception. + /// + /// The exception. + /// A formatted message. + /// Parameters to be injected into the formatted message. + public void Error(Exception exception, string format, params object[] args) + { + Debug.WriteLine(CreateLogMessage(format + " - Exception = " + exception.ToString(), args), ErrorText); + } + #endregion + } +} diff --git a/src/MarkPad/Framework/NLogAdapter.cs b/src/MarkPad/Framework/NLogAdapter.cs deleted file mode 100644 index f81fa5ba..00000000 --- a/src/MarkPad/Framework/NLogAdapter.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using Caliburn.Micro; -using NLog; - -namespace MarkPad.Framework -{ - internal class NLogAdapter : ILog - { - private readonly Logger logger; - - public NLogAdapter(Type type) - { - logger = NLog.LogManager.GetLogger(type.FullName); - } - - #region ILog Members - - public void Error(Exception exception) - { - logger.ErrorException(exception.Message, exception); - } - - public void Info(string format, params object[] args) - { - logger.Info(format, args); - } - - public void Warn(string format, params object[] args) - { - logger.Warn(format, args); - } - - #endregion - } -} diff --git a/src/MarkPad/MarkPad.csproj b/src/MarkPad/MarkPad.csproj index 3b64b3fa..fbe76d97 100644 --- a/src/MarkPad/MarkPad.csproj +++ b/src/MarkPad/MarkPad.csproj @@ -20,6 +20,21 @@ true true 4.0.30816.0 + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true x86 @@ -63,6 +78,12 @@ ..\..\packages\Caliburn.Micro.1.2.0\lib\Net40\Caliburn.Micro.dll + + ..\..\packages\Caliburn.Micro.Logging.1.2.1\lib\net40\Caliburn.Micro.Logging.dll + + + ..\..\packages\Caliburn.Micro.Logging.NLog.1.2.1\lib\net40\Caliburn.Micro.Logging.NLog.dll + ..\..\packages\xmlrpcnet.2.5.0\lib\net20\CookComputing.XmlRpcV2.dll @@ -104,6 +125,7 @@ AboutView.xaml + @@ -176,7 +198,6 @@ - Code @@ -184,6 +205,7 @@ Libs\x86\AwesomiumProcess + @@ -263,6 +285,28 @@ PreserveNewest + + + False + Microsoft .NET Framework 4 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 3.5 SP1 + false + + + False + Windows Installer 3.1 + true + + diff --git a/src/MarkPad/packages.config b/src/MarkPad/packages.config index 40660437..7eef0ad7 100644 --- a/src/MarkPad/packages.config +++ b/src/MarkPad/packages.config @@ -3,6 +3,8 @@ + +