From 7fa329a349a1d493ae74bd908d81a0d6a020079b Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Thu, 11 Oct 2018 16:45:22 +0200 Subject: [PATCH] jj: update Logging to 0.0.0.4 --- Modules.Logging/LogConfig.vb | 131 ++++++++++----------- Modules.Logging/Logging.vbproj | 3 +- Modules.Logging/My Project/AssemblyInfo.vb | 2 +- Modules.Logging/packages.config | 2 +- 4 files changed, 67 insertions(+), 71 deletions(-) diff --git a/Modules.Logging/LogConfig.vb b/Modules.Logging/LogConfig.vb index a0c4b0ee..d490ab7c 100644 --- a/Modules.Logging/LogConfig.vb +++ b/Modules.Logging/LogConfig.vb @@ -3,88 +3,83 @@ Imports NLog Imports NLog.Config Imports NLog.Targets +''' LogConfig +''' 0.0.0.4 +''' 02.10.2018 ''' -''' MODULE: LogConfig -''' -''' VERSION: 0.0.0.3 -''' -''' DATE: 02.10.2018 -''' -''' DESCRIPTION: Module that writes file-logs to different locations: -''' local application data, the current directory or a custom path. -''' Files and directories will be automatically created. -''' -''' Three different logfiles will be generated: -''' -''' - Default: Info and Warn Log Levels -''' - Error: Warn, Error and Fatal Log Level -''' - Debug: Debug Log Level -''' -''' -''' DEPENDENCIES: NLog, >= 4.5.8 -''' -''' PARAMETERS: logPath, PathType -''' The basepath to write logs to. Can be AppData, CurrentDirectory or CustomPath. +''' Module that writes file-logs to different locations: +''' local application data, the current directory or a custom path. +''' Files and directories will be automatically created. +''' +''' +''' NLog, >= 4.5.8 +''' +''' +''' logPath, PathType +''' The basepath to write logs to. Can be AppData, CurrentDirectory or CustomPath. ''' -''' - AppData: writes to local application data directory -''' - CurrentDirectory: writes to `Log` directory relative to the current directory -''' - CustomPath: writes to custom path specified in `customLogPath` +''' - AppData: writes to local application data directory +''' - CurrentDirectory: writes to `Log` directory relative to the current directory +''' - CustomPath: writes to custom path specified in `customLogPath` ''' -''' customLogPath, String (optional) -''' If `logPath` is set to custom, this defines the custom logPath. +''' customLogPath, String (optional) +''' If `logPath` is set to custom, this defines the custom logPath. ''' -''' suffix, String (optional) -''' If set to anything other than Nothing, extends the logfile name with this suffix. -''' -''' PROPERTIES: LogFile, String (readonly) -''' Returns the full path of the default log file. +''' suffix, String (optional) +''' If set to anything other than Nothing, extends the logfile name with this suffix. +''' +''' +''' LogFile, String (readonly) +''' Returns the full path of the default log file. ''' -''' LogPath, String (readonly) -''' Returns the path to the log directory. +''' LogPath, String (readonly) +''' Returns the path to the log directory. ''' -''' LogFactory, NLog.LogFactory (readonly) -''' Returns the LogFactory that is used to create the Logger object +''' LogFactory, NLog.LogFactory (readonly) +''' Returns the LogFactory that is used to create the Logger object ''' -''' Debug, Boolean -''' Determines if the debug log should be written. -''' -''' EXAMPLES: Imports DigitalData.Modules.Logging +''' Debug, Boolean +''' Determines if the debug log should be written. +''' +''' +''' Imports DigitalData.Modules.Logging ''' -''' Class FooProgram -''' Private Logger as Logger -''' Private LogConfig as LogConfig +''' Class FooProgram +''' Private Logger as Logger +''' Private LogConfig as LogConfig ''' -''' Public Sub New() -''' LogConfig = new LogConfig(args) -''' Logger = LogConfig.GetLogger() -''' End Sub +''' Public Sub New() +''' LogConfig = new LogConfig(args) +''' Logger = LogConfig.GetLogger() +''' End Sub ''' -''' Public Sub Bar() -''' Logger.Info("Baz") -''' End Sub -''' End Class +''' Public Sub Bar() +''' Logger.Info("Baz") +''' End Sub +''' End Class ''' -''' Class FooLib -''' Private Logger as NLog.Logger +''' Class FooLib +''' Private Logger as NLog.Logger ''' -''' Public Sub New(LogConfig as LogConfig) -''' Logger = LogConfig.GetLogger() -''' End Sub +''' Public Sub New(LogConfig as LogConfig) +''' Logger = LogConfig.GetLogger() +''' End Sub ''' -''' Public Sub Bar() -''' Logger.Info("Baz") -''' End Sub -''' End Class +''' Public Sub Bar() +''' Logger.Info("Baz") +''' End Sub +''' End Class +''' +''' +''' If logpath can not be written to, falls back to temp folder as defined in: +''' https://docs.microsoft.com/de-de/dotnet/api/system.io.path.gettemppath?view=netframework-4.7.2 ''' -''' REMARKS: If logpath can not be written to, falls back to temp folder as defined in: -''' https://docs.microsoft.com/de-de/dotnet/api/system.io.path.gettemppath?view=netframework-4.7.2 +''' If used in a service, LogPath must be set to CustomPath, otherwise the Log will be written to System32! ''' -''' If used in a service, LogPath must be set to CustomPath, otherwise the Log will be written to System32! -''' -''' For NLog Troubleshooting, set the following Environment variables to write the NLog internal Log: -''' - NLOG_INTERNAL_LOG_LEVEL: Debug -''' - NLOG_INTERNAL_LOG_FILE: ex. C:\Temp\Nlog_Internal.log -''' +''' For NLog Troubleshooting, set the following Environment variables to write the NLog internal Log: +''' - NLOG_INTERNAL_LOG_LEVEL: Debug +''' - NLOG_INTERNAL_LOG_FILE: ex. C:\Temp\Nlog_Internal.log +''' Public Class LogConfig Private Const KEEP_FILES_OPEN As Boolean = False ' MAX_ARCHIVES_FILES works like this (in version 4.5.8): @@ -161,7 +156,7 @@ Public Class LogConfig End Property ''' - ''' Initializes a new Logger for a specific `Product` and optinally a filename-suffix. + ''' Initializes a new LogConfig object with a logpath and optinally a filename-suffix. ''' ''' The basepath to write logs to. Can be AppData, CurrentDirectory or CustomPath. ''' If `logPath` is set to custom, this defines the custom logPath. diff --git a/Modules.Logging/Logging.vbproj b/Modules.Logging/Logging.vbproj index 111738f6..b7982df8 100644 --- a/Modules.Logging/Logging.vbproj +++ b/Modules.Logging/Logging.vbproj @@ -45,7 +45,8 @@ - ..\packages\NLog.4.5.8\lib\net45\NLog.dll + ..\packages\NLog.4.5.10\lib\net45\NLog.dll + False diff --git a/Modules.Logging/My Project/AssemblyInfo.vb b/Modules.Logging/My Project/AssemblyInfo.vb index 0744f0df..8dccce0d 100644 --- a/Modules.Logging/My Project/AssemblyInfo.vb +++ b/Modules.Logging/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - + diff --git a/Modules.Logging/packages.config b/Modules.Logging/packages.config index a3ffb2eb..9764f16f 100644 --- a/Modules.Logging/packages.config +++ b/Modules.Logging/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file