jj: update Logging to 0.0.0.4
This commit is contained in:
parent
e54b1d2843
commit
7fa329a349
@ -3,88 +3,83 @@ Imports NLog
|
||||
Imports NLog.Config
|
||||
Imports NLog.Targets
|
||||
|
||||
''' <module>LogConfig</module>
|
||||
''' <version>0.0.0.4</version>
|
||||
''' <date>02.10.2018</date>
|
||||
''' <summary>
|
||||
''' 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.
|
||||
'''
|
||||
''' - 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.
|
||||
'''
|
||||
''' 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.
|
||||
'''
|
||||
''' 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
|
||||
'''
|
||||
''' Debug, Boolean
|
||||
''' Determines if the debug log should be written.
|
||||
'''
|
||||
''' EXAMPLES: Imports DigitalData.Modules.Logging
|
||||
'''
|
||||
''' Class FooProgram
|
||||
''' Private Logger as Logger
|
||||
''' Private LogConfig as LogConfig
|
||||
'''
|
||||
''' Public Sub New()
|
||||
''' LogConfig = new LogConfig(args)
|
||||
''' Logger = LogConfig.GetLogger()
|
||||
''' End Sub
|
||||
'''
|
||||
''' Public Sub Bar()
|
||||
''' Logger.Info("Baz")
|
||||
''' End Sub
|
||||
''' End Class
|
||||
'''
|
||||
''' Class FooLib
|
||||
''' Private Logger as NLog.Logger
|
||||
'''
|
||||
''' Public Sub New(LogConfig as LogConfig)
|
||||
''' Logger = LogConfig.GetLogger()
|
||||
''' End Sub
|
||||
'''
|
||||
''' Public Sub Bar()
|
||||
''' Logger.Info("Baz")
|
||||
''' End Sub
|
||||
''' End Class
|
||||
'''
|
||||
''' 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!
|
||||
'''
|
||||
''' 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
|
||||
''' 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.
|
||||
''' </summary>
|
||||
''' <dependencies>
|
||||
''' NLog, >= 4.5.8
|
||||
''' </dependencies>
|
||||
''' <params>
|
||||
''' 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`
|
||||
'''
|
||||
''' 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.
|
||||
''' </params>
|
||||
''' <props>
|
||||
''' LogFile, String (readonly)
|
||||
''' Returns the full path of the default log file.
|
||||
'''
|
||||
''' 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
|
||||
'''
|
||||
''' Debug, Boolean
|
||||
''' Determines if the debug log should be written.
|
||||
''' </props>
|
||||
''' <example>
|
||||
''' Imports DigitalData.Modules.Logging
|
||||
'''
|
||||
''' Class FooProgram
|
||||
''' Private Logger as Logger
|
||||
''' Private LogConfig as LogConfig
|
||||
'''
|
||||
''' Public Sub New()
|
||||
''' LogConfig = new LogConfig(args)
|
||||
''' Logger = LogConfig.GetLogger()
|
||||
''' End Sub
|
||||
'''
|
||||
''' Public Sub Bar()
|
||||
''' Logger.Info("Baz")
|
||||
''' End Sub
|
||||
''' End Class
|
||||
'''
|
||||
''' Class FooLib
|
||||
''' Private Logger as NLog.Logger
|
||||
'''
|
||||
''' Public Sub New(LogConfig as LogConfig)
|
||||
''' Logger = LogConfig.GetLogger()
|
||||
''' End Sub
|
||||
'''
|
||||
''' Public Sub Bar()
|
||||
''' Logger.Info("Baz")
|
||||
''' End Sub
|
||||
''' End Class
|
||||
''' </example>
|
||||
''' <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!
|
||||
'''
|
||||
''' 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
|
||||
''' </remarks>
|
||||
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
|
||||
|
||||
''' <summary>
|
||||
''' 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.
|
||||
''' </summary>
|
||||
''' <param name="logPath">The basepath to write logs to. Can be AppData, CurrentDirectory or CustomPath.</param>
|
||||
''' <param name="customLogPath">If `logPath` is set to custom, this defines the custom logPath.</param>
|
||||
|
||||
@ -45,7 +45,8 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.5.8\lib\net45\NLog.dll</HintPath>
|
||||
<HintPath>..\packages\NLog.4.5.10\lib\net45\NLog.dll</HintPath>
|
||||
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
|
||||
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("0.0.0.3")>
|
||||
<Assembly: AssemblyVersion("0.0.0.4")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NLog" version="4.5.8" targetFramework="net461" />
|
||||
<package id="NLog" version="4.5.10" targetFramework="net461" />
|
||||
</packages>
|
||||
Loading…
x
Reference in New Issue
Block a user