Inhouse.Sdk.Logger
1.0.1.5
dotnet add package Inhouse.Sdk.Logger --version 1.0.1.5
NuGet\Install-Package Inhouse.Sdk.Logger -Version 1.0.1.5
<PackageReference Include="Inhouse.Sdk.Logger" Version="1.0.1.5" />
<PackageVersion Include="Inhouse.Sdk.Logger" Version="1.0.1.5" />
<PackageReference Include="Inhouse.Sdk.Logger" />
paket add Inhouse.Sdk.Logger --version 1.0.1.5
#r "nuget: Inhouse.Sdk.Logger, 1.0.1.5"
#:package Inhouse.Sdk.Logger@1.0.1.5
#addin nuget:?package=Inhouse.Sdk.Logger&version=1.0.1.5
#tool nuget:?package=Inhouse.Sdk.Logger&version=1.0.1.5
Logger SDK
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET Framework | net is compatible. |
-
- Newtonsoft.Json (>= 6.0.6)
GitHub repositories
This package is not used by any popular GitHub repositories.
Inhouse.Sdk.Logger
Logger to .Net Apps
This logger can log on Console, TextFiles, Documents(csv,tsv), Splunk via TCP
logger is singelton, you dont need create a instance only need wrtie
<code> LogProviderManager.Logger.Log(LogType.info, "Log FA!") </code>
Parameters:
name = <string> name for reference the log.
type = Type Provider for the log
* Inhouse.Sdk.Logger.Providers.ConsoleLogProvider, Inhouse.Sdk.Logger <- Console
* Inhouse.Sdk.Logger.Providers.TextLogProvider, Inhouse.Sdk.Logger <- Text
* Inhouse.Sdk.Logger.Providers.DocumentLogProvider, Inhouse.Sdk.Logger <- Document like csv,tsv
* Inhouse.Sdk.Logger.Providers.SplunkLogProvider, Inhouse.Sdk.Logger <- Splunk via TCP
active = enable or disable
* true
* false
levelLog = filter for the log.
* debug
* info
* warning
* error
* fatal
* userdata
* appdata
* systemdata
* none
Tip: 1.- When you select the level the logger write the including level and the next forwards
2.- if you put "*" before the level the logger only write log for this level with out forwards
3.- You can arrange the level that you can write if only want debug to error you can put debug|error and the logger only write the
log event debug,info,warning and error.
pattern = the pattern to write the event the keys are
* %TimeStamp
* %UtcTimeStamp
* %Application
* %HostName
* %Ip
* %ThreadId
* %ThreadName
* %ClassName
* %FunctionName
* %Level
* %Item
* %Message
documentType = type to document
* csv
* tsv
fileRolling = file=<nameFile.ext>;maxsize=<size with unit kb,mb,gb>;directory=<path of directory>
file rolling rename the log automatic.
host = ip for the host to connect
port = port for the host to connect
Parameter used for providers:
Console
* type
* active
* levelLog
* pattern
Text
* type
* active
* levelLog
* pattern
* fileRolling
Document
* type
* active
* levelLog
* documentType
* fileRolling
Splunk
* type
* active
* levelLog
* pattern
* host
* port
Use:
0) Add Librery by NuGet
1) Create App.config
2) Configure Logs on app.config:
<configSections>
<section name="LogProviders" type="Inhouse.Sdk.Logger.LogProviderConfiguration, Inhouse.Sdk.Logger" />
</configSections>
<LogProviders>
<providers>
<add name="Console"
type="Inhouse.Sdk.Logger.Providers.ConsoleLogProvider, Inhouse.Sdk.Logger"
active="true"
levelLog="debug"
pattern="%HostName %Ip %ClassName %FunctionName %Message" />
<add name="text"
type="Inhouse.Sdk.Logger.Providers.TextLogProvider, Inhouse.Sdk.Logger"
active="false"
levelLog="debug"
pattern="%TimeStamp %UtcTimeStamp %Application %HostName %Ip [%ThreadId] %ThreadName %ClassName %FunctionName %Level %Item %Message"
fileRolling="file=test.log;maxsize=0;directory=C:\temp" />
<add name="document"
type="Inhouse.Sdk.Logger.Providers.DocumentLogProvider, Inhouse.Sdk.Logger"
active="false"
levelLog="debug"
documentType="cvs"
fileRolling="file=test;maxsize=10kb;directory=C:\temp" />
<add name="splunk"
type="Inhouse.Sdk.Logger.Providers.SplunkLogProvider, Inhouse.Sdk.Logger"
active="true"
levelLog="debug"
host="127.0.0.1" port="18000"
pattern="%TimeStamp %UtcTimeStamp %Application %HostName %Ip [%ThreadId] %ThreadName %ClassName %FunctionName %Level %Item %Message" />
</providers>
</LogProviders>
Write Log in functions sample c#:
static void FA()
{
LogProviderManager.Logger.Log(LogType.info, "Log FA!");
}
Change Log
*****************************
V 1.0.1.5
- Delete the event log write for security errors.
*****************************
V 1.0.1.4
*****************************
V 1.0.1.3
*****************************
V 1.0.1.2
*****************************
V 1.0.1.1
*****************************
V 1.0.1.0
- Initial Release!