diff --git a/.vs/Stone_Red-C-Sharp-Utilities/DesignTimeBuild/.dtbcache.v2 b/.vs/Stone_Red-C-Sharp-Utilities/DesignTimeBuild/.dtbcache.v2 index 9849f40..7dd37df 100644 Binary files a/.vs/Stone_Red-C-Sharp-Utilities/DesignTimeBuild/.dtbcache.v2 and b/.vs/Stone_Red-C-Sharp-Utilities/DesignTimeBuild/.dtbcache.v2 differ diff --git a/.vs/Stone_Red-C-Sharp-Utilities/v16/.suo b/.vs/Stone_Red-C-Sharp-Utilities/v16/.suo index 4f74ee9..71a4be5 100644 Binary files a/.vs/Stone_Red-C-Sharp-Utilities/v16/.suo and b/.vs/Stone_Red-C-Sharp-Utilities/v16/.suo differ diff --git a/README.md b/README.md index 01cf942..84b460d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Stone_Red-C-Sharp-Utilities -> Adds useful C# methods. +> Provides useful C# methods. ## Install @@ -64,7 +64,7 @@ https://www.nuget.org/packages/Stone_Red-C-Sharp-Utilities ------------- ``` -### Stone_Red_Utilities.ColorConsole +### Stone_Red_Utilities.ConsoleExtentions #### Methods: * Write * Description: Writes the text representation of the specified object to the standard output stream. @@ -187,3 +187,52 @@ https://www.nuget.org/packages/Stone_Red-C-Sharp-Utilities ``` True ``` +### Stone_Red_Utilities.Logging +#### Constructors: + * Logger + * Initializes the logger with the default format. + * Parameters: `LogTarget logTarg`, `string defaultFormat` + * Example usage: + ```cs + Logger logger = new Logger(LogTarget.Console, "{:HH:mm:ss} | {,-7} | {,-15} | {}"); + ``` + * Logger + * Initializes the logger with the default format and a file path. + * Parameters: `LogTarget logTarg`, `string file`, `string defaultFormat` + * Example usage: + ```cs + Logger logger = new Logger(LogTarget.ConsoleAndFile, "events.log", "{:HH:mm:ss} | {,-7} | {,-15} | {}"); + ``` +#### Methods: + * Log + * Description: Log the message to the specified output + * Parameters: `string message`, `string source`, `LogSeverity logSeverity` + * Example usage: + ```cs + logger.Log("something happend", "Update manager", LogSeverity.Error); + ``` + * Output (Depends on the specified log format): + ``` + 19:15:14 | Error | Update manager | something happend + ``` + * LogIf + * Description: Log the message to the specified output if the condition is met + * Parameters: `bool condition`, `string message`, `string source`, `LogSeverity logSeverity` + * Example usage: + ```cs + logger.Log(IsValid(),"something is invalid", "Setup", LogSeverity.Error); + ``` + * Output (Depends on the specified log format): + ``` + 19:15:14 | Error | Update manager | something happend + ``` + * ClearLogFile + * Description: Clears the log file + * Example usage: + ```cs + logger.ClearLogFile(); + ``` + * Output (Depends on the specified log format): + ``` + 19:15:14 | Error | Update manager | something happend + ``` \ No newline at end of file diff --git a/Stone_Red-C-Sharp-Utilities/Logging.cs b/Stone_Red-C-Sharp-Utilities/Logging.cs index 015ea8e..9e978a2 100644 --- a/Stone_Red-C-Sharp-Utilities/Logging.cs +++ b/Stone_Red-C-Sharp-Utilities/Logging.cs @@ -97,7 +97,7 @@ namespace Stone_Red_Utilities.Logging public string FileLogFormat { get; set; } /// - /// Initializes the logger with the default format + /// Initializes the logger with the default format and a file path /// /// /// @@ -105,7 +105,7 @@ namespace Stone_Red_Utilities.Logging public Logger(LogTarget logTarg = LogTarget.Console, string file = null, string defaultFormat = "{:HH:mm:ss} | {,-7} | {,-15} | {}") { if (logTarg == LogTarget.ConsoleAndFile || logTarg == LogTarget.DebugAndFile || logTarg == LogTarget.File || logTarg == LogTarget.All) - logPath = file ?? throw new ArgumentNullException($"file can't be null!"); + logPath = file ?? throw new ArgumentNullException(nameof(file), $"file can't be null!"); logTarget = logTarg; ConsoleLogFormat = defaultFormat; @@ -121,7 +121,7 @@ namespace Stone_Red_Utilities.Logging public Logger(LogTarget logTarg = LogTarget.Console, string defaultFormat = "{} | {,-7} | {,-15} | {}") { if (logTarg == LogTarget.ConsoleAndFile || logTarg == LogTarget.DebugAndFile || logTarg == LogTarget.File || logTarg == LogTarget.All) - throw new ArgumentNullException($"file can't be null!"); + throw new ArgumentNullException("file", $"file can't be null!"); logTarget = logTarg; ConsoleLogFormat = defaultFormat; @@ -144,7 +144,7 @@ namespace Stone_Red_Utilities.Logging } /// - /// Log the message to the specified output when the condition is met + /// Log the message to the specified output if the condition is met /// /// /// @@ -160,7 +160,7 @@ namespace Stone_Red_Utilities.Logging } /// - /// Clears log file + /// Clears the log file /// public void ClearLogFile() { @@ -221,7 +221,7 @@ namespace Stone_Red_Utilities.Logging }; } - private string GetFormattedString(string format, LogSeverity logSeverity, string source, string message, string memberName = "", string sourceFilePath = "", int sourceLineNumber = 0) + private string GetFormattedString(string format, LogSeverity logSeverity, string source, string message, string memberName, string sourceFilePath, int sourceLineNumber) { format = format .Replace("", "0") diff --git a/Stone_Red-C-Sharp-Utilities/Stone_Red-C-Sharp-Utilities.csproj b/Stone_Red-C-Sharp-Utilities/Stone_Red-C-Sharp-Utilities.csproj index 51e4f6b..89312b5 100644 --- a/Stone_Red-C-Sharp-Utilities/Stone_Red-C-Sharp-Utilities.csproj +++ b/Stone_Red-C-Sharp-Utilities/Stone_Red-C-Sharp-Utilities.csproj @@ -14,7 +14,7 @@ false 1.0.0.2 1.0.0.2 - 1.0.0.2 + 1.0.1.0 diff --git a/Stone_Red-C-Sharp-Utilities/Stone_Red-C-Sharp-Utilities.xml b/Stone_Red-C-Sharp-Utilities/Stone_Red-C-Sharp-Utilities.xml index e6c9faf..b8e3aea 100644 --- a/Stone_Red-C-Sharp-Utilities/Stone_Red-C-Sharp-Utilities.xml +++ b/Stone_Red-C-Sharp-Utilities/Stone_Red-C-Sharp-Utilities.xml @@ -96,6 +96,13 @@ + + + Suspends execution until the user presses a key + + + + Specifies the severity of the log target. @@ -183,7 +190,7 @@ - Initializes the logger with the default format + Initializes the logger with the default format and a file path @@ -209,7 +216,7 @@ - Log the message to the specified output when the condition is met + Log the message to the specified output if the condition is met @@ -221,7 +228,7 @@ - Clears log file + Clears the log file diff --git a/Stone_Red-C-Sharp-Utilities/bin/Release/Stone_Red-C-Sharp-Utilities.1.0.0.1.nupkg b/Stone_Red-C-Sharp-Utilities/bin/Release/Stone_Red-C-Sharp-Utilities.1.0.0.1.nupkg deleted file mode 100644 index 8dcb6ad..0000000 Binary files a/Stone_Red-C-Sharp-Utilities/bin/Release/Stone_Red-C-Sharp-Utilities.1.0.0.1.nupkg and /dev/null differ diff --git a/Stone_Red-C-Sharp-Utilities/bin/Release/Stone_Red-C-Sharp-Utilities.1.0.0.2.nupkg b/Stone_Red-C-Sharp-Utilities/bin/Release/Stone_Red-C-Sharp-Utilities.1.0.0.2.nupkg deleted file mode 100644 index 7d971b5..0000000 Binary files a/Stone_Red-C-Sharp-Utilities/bin/Release/Stone_Red-C-Sharp-Utilities.1.0.0.2.nupkg and /dev/null differ diff --git a/Stone_Red-C-Sharp-Utilities/bin/Release/Stone_Red-C-Sharp-Utilities.1.0.0.nupkg b/Stone_Red-C-Sharp-Utilities/bin/Release/Stone_Red-C-Sharp-Utilities.1.0.0.nupkg deleted file mode 100644 index e445f98..0000000 Binary files a/Stone_Red-C-Sharp-Utilities/bin/Release/Stone_Red-C-Sharp-Utilities.1.0.0.nupkg and /dev/null differ diff --git a/Stone_Red-C-Sharp-Utilities/bin/Release/Stone_Red-C-Sharp-Utilities.1.0.1.nupkg b/Stone_Red-C-Sharp-Utilities/bin/Release/Stone_Red-C-Sharp-Utilities.1.0.1.nupkg new file mode 100644 index 0000000..c6664d3 Binary files /dev/null and b/Stone_Red-C-Sharp-Utilities/bin/Release/Stone_Red-C-Sharp-Utilities.1.0.1.nupkg differ diff --git a/Stone_Red-C-Sharp-Utilities/bin/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.deps.json b/Stone_Red-C-Sharp-Utilities/bin/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.deps.json index 5237ff3..6c0c41c 100644 --- a/Stone_Red-C-Sharp-Utilities/bin/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.deps.json +++ b/Stone_Red-C-Sharp-Utilities/bin/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.deps.json @@ -7,7 +7,7 @@ "targets": { ".NETStandard,Version=v2.1": {}, ".NETStandard,Version=v2.1/": { - "Stone_Red-C-Sharp-Utilities/1.0.0.2": { + "Stone_Red-C-Sharp-Utilities/1.0.1.0": { "runtime": { "Stone_Red-C-Sharp-Utilities.dll": {} } @@ -15,7 +15,7 @@ } }, "libraries": { - "Stone_Red-C-Sharp-Utilities/1.0.0.2": { + "Stone_Red-C-Sharp-Utilities/1.0.1.0": { "type": "project", "serviceable": false, "sha512": "" diff --git a/Stone_Red-C-Sharp-Utilities/bin/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.dll b/Stone_Red-C-Sharp-Utilities/bin/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.dll index 2ab4979..d725974 100644 Binary files a/Stone_Red-C-Sharp-Utilities/bin/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.dll and b/Stone_Red-C-Sharp-Utilities/bin/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.dll differ diff --git a/Stone_Red-C-Sharp-Utilities/bin/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.pdb b/Stone_Red-C-Sharp-Utilities/bin/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.pdb index 7b35314..649a472 100644 Binary files a/Stone_Red-C-Sharp-Utilities/bin/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.pdb and b/Stone_Red-C-Sharp-Utilities/bin/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.pdb differ diff --git a/Stone_Red-C-Sharp-Utilities/bin/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.xml b/Stone_Red-C-Sharp-Utilities/bin/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.xml index 157fc12..b8e3aea 100644 --- a/Stone_Red-C-Sharp-Utilities/bin/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.xml +++ b/Stone_Red-C-Sharp-Utilities/bin/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.xml @@ -77,25 +77,160 @@ - + Console Extentions - + Writes the text representation of the specified object to the standard output stream. - + Writes the text representation of the specified object, followed by the current line terminator, to the standard output stream. + + + Suspends execution until the user presses a key + + + + + + + Specifies the severity of the log target. + + + + + Writes log to console + + + + + Writes log to debug console + + + + + Writes log to file + + + + + Writes log to console and file + + + + + Writes log to debug console and file + + + + + Writes log to console debug console and file + + + + + Specifies the severity of the log message. + + + + + Logs that contain the most detailed messages. + + + + + Logs that track the general flow of the application. + + + + + Logs that highlight an abnormal activity in the flow of execution. + + + + + Logs that highlight when the flow of execution is stopped due to a failure. + + + + + Logs that contain the most severe level of error. This type of error indicate that immediate attention may be required. + + + + + Class used for logging + + + + + Format that is used when logging to the console + + + + + Format that is used when logging to the debug console + + + + + Format that is used when logging to a file + + + + + Initializes the logger with the default format and a file path + + + + + + + + Initializes the logger with the default format + + + + + + + Log the message to the specified output + + + + + + + + + + + Log the message to the specified output if the condition is met + + + + + + + + + + + + Clears the log file + + Extentions @@ -133,5 +268,22 @@ + + + Truncates a string to the specified length. + + + + + + + + Truncates a string to the specified length. + + + + + + diff --git a/Stone_Red-C-Sharp-Utilities/obj/Release/Stone_Red-C-Sharp-Utilities.1.0.0.3.nuspec b/Stone_Red-C-Sharp-Utilities/obj/Release/Stone_Red-C-Sharp-Utilities.1.0.0.3.nuspec new file mode 100644 index 0000000..fd8def3 --- /dev/null +++ b/Stone_Red-C-Sharp-Utilities/obj/Release/Stone_Red-C-Sharp-Utilities.1.0.0.3.nuspec @@ -0,0 +1,22 @@ + + + + Stone_Red-C-Sharp-Utilities + 1.0.0.3 + Stone_Red + false + LICENSE + https://aka.ms/deprecateLicenseUrl + Adds useful extentions. + Console, Table, Print + + + + + + + + + + + \ No newline at end of file diff --git a/Stone_Red-C-Sharp-Utilities/obj/Release/Stone_Red-C-Sharp-Utilities.1.0.1.nuspec b/Stone_Red-C-Sharp-Utilities/obj/Release/Stone_Red-C-Sharp-Utilities.1.0.1.nuspec new file mode 100644 index 0000000..e655307 --- /dev/null +++ b/Stone_Red-C-Sharp-Utilities/obj/Release/Stone_Red-C-Sharp-Utilities.1.0.1.nuspec @@ -0,0 +1,22 @@ + + + + Stone_Red-C-Sharp-Utilities + 1.0.1 + Stone_Red + false + LICENSE + https://aka.ms/deprecateLicenseUrl + Adds useful extentions. + Console, Table, Print + + + + + + + + + + + \ No newline at end of file diff --git a/Stone_Red-C-Sharp-Utilities/obj/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.AssemblyInfo.cs b/Stone_Red-C-Sharp-Utilities/obj/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.AssemblyInfo.cs index 0a33004..3d3b10a 100644 --- a/Stone_Red-C-Sharp-Utilities/obj/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.AssemblyInfo.cs +++ b/Stone_Red-C-Sharp-Utilities/obj/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.AssemblyInfo.cs @@ -15,7 +15,7 @@ using System.Reflection; [assembly: System.Reflection.AssemblyConfigurationAttribute("Release")] [assembly: System.Reflection.AssemblyDescriptionAttribute("Adds useful extentions.")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.2")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0.2")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.1.0")] [assembly: System.Reflection.AssemblyProductAttribute("Stone_Red-C-Sharp-Utilities")] [assembly: System.Reflection.AssemblyTitleAttribute("Stone_Red-C-Sharp-Utilities")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.2")] diff --git a/Stone_Red-C-Sharp-Utilities/obj/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.AssemblyInfoInputs.cache b/Stone_Red-C-Sharp-Utilities/obj/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.AssemblyInfoInputs.cache index d6c0b7e..0b33404 100644 --- a/Stone_Red-C-Sharp-Utilities/obj/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.AssemblyInfoInputs.cache +++ b/Stone_Red-C-Sharp-Utilities/obj/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.AssemblyInfoInputs.cache @@ -1 +1 @@ -4add0698c50aff5e6bd57f5b02d6f14125a759e5 +86ed32e371a4832ff8ffcde04e090abd3861fffd diff --git a/Stone_Red-C-Sharp-Utilities/obj/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.csproj.CoreCompileInputs.cache b/Stone_Red-C-Sharp-Utilities/obj/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.csproj.CoreCompileInputs.cache index 6bc4183..ef0e52b 100644 --- a/Stone_Red-C-Sharp-Utilities/obj/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.csproj.CoreCompileInputs.cache +++ b/Stone_Red-C-Sharp-Utilities/obj/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -a57cbf8e3143b81e8c898c1738148a8800dbe5ce +ab7c68485a41e4caec8918d8132b9a5c789193c3 diff --git a/Stone_Red-C-Sharp-Utilities/obj/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.csprojAssemblyReference.cache b/Stone_Red-C-Sharp-Utilities/obj/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.csprojAssemblyReference.cache index 3dd4cb6..bf3f189 100644 Binary files a/Stone_Red-C-Sharp-Utilities/obj/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.csprojAssemblyReference.cache and b/Stone_Red-C-Sharp-Utilities/obj/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.csprojAssemblyReference.cache differ diff --git a/Stone_Red-C-Sharp-Utilities/obj/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.dll b/Stone_Red-C-Sharp-Utilities/obj/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.dll index 2ab4979..d725974 100644 Binary files a/Stone_Red-C-Sharp-Utilities/obj/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.dll and b/Stone_Red-C-Sharp-Utilities/obj/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.dll differ diff --git a/Stone_Red-C-Sharp-Utilities/obj/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.pdb b/Stone_Red-C-Sharp-Utilities/obj/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.pdb index 7b35314..649a472 100644 Binary files a/Stone_Red-C-Sharp-Utilities/obj/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.pdb and b/Stone_Red-C-Sharp-Utilities/obj/Release/netstandard2.1/Stone_Red-C-Sharp-Utilities.pdb differ diff --git a/Stone_Red-C-Sharp-Utilities/obj/Stone_Red-C-Sharp-Utilities.csproj.nuget.dgspec.json b/Stone_Red-C-Sharp-Utilities/obj/Stone_Red-C-Sharp-Utilities.csproj.nuget.dgspec.json index 7df2d01..e81c55f 100644 --- a/Stone_Red-C-Sharp-Utilities/obj/Stone_Red-C-Sharp-Utilities.csproj.nuget.dgspec.json +++ b/Stone_Red-C-Sharp-Utilities/obj/Stone_Red-C-Sharp-Utilities.csproj.nuget.dgspec.json @@ -5,7 +5,7 @@ }, "projects": { "C:\\Users\\David\\Google Drive\\Programmieren\\Stone_Red-C-Sharp-Utilities\\Stone_Red-C-Sharp-Utilities\\Stone_Red-C-Sharp-Utilities.csproj": { - "version": "1.0.0.2", + "version": "1.0.1", "restore": { "projectUniqueName": "C:\\Users\\David\\Google Drive\\Programmieren\\Stone_Red-C-Sharp-Utilities\\Stone_Red-C-Sharp-Utilities\\Stone_Red-C-Sharp-Utilities.csproj", "projectName": "Stone_Red-C-Sharp-Utilities", diff --git a/Stone_Red-C-Sharp-Utilities/obj/project.assets.json b/Stone_Red-C-Sharp-Utilities/obj/project.assets.json index 5536f11..37b62ea 100644 --- a/Stone_Red-C-Sharp-Utilities/obj/project.assets.json +++ b/Stone_Red-C-Sharp-Utilities/obj/project.assets.json @@ -12,7 +12,7 @@ "C:\\Microsoft\\Xamarin\\NuGet\\": {} }, "project": { - "version": "1.0.0.2", + "version": "1.0.1", "restore": { "projectUniqueName": "C:\\Users\\David\\Google Drive\\Programmieren\\Stone_Red-C-Sharp-Utilities\\Stone_Red-C-Sharp-Utilities\\Stone_Red-C-Sharp-Utilities.csproj", "projectName": "Stone_Red-C-Sharp-Utilities", diff --git a/Stone_Red-C-Sharp-Utilities/obj/project.nuget.cache b/Stone_Red-C-Sharp-Utilities/obj/project.nuget.cache index 3df5ce0..b5ae36f 100644 --- a/Stone_Red-C-Sharp-Utilities/obj/project.nuget.cache +++ b/Stone_Red-C-Sharp-Utilities/obj/project.nuget.cache @@ -1,6 +1,6 @@ { "version": 2, - "dgSpecHash": "aWSVR7De4Q2VY3O6G2D1iAjpBH8farjDoaC5cvp5irFy5kocS3MdyJjSHdKZ0zSh3PnZ9Aj3Gdvrb1If7qdwSg==", + "dgSpecHash": "9bUdOQXkoJVmBHKtXL8WIV2wGOGQ2ZUNAipYzs4vkTUUx7it6qWwjRlEnfdvkceTSY3j3kyImDuhrb0sCF5omw==", "success": true, "projectFilePath": "C:\\Users\\David\\Google Drive\\Programmieren\\Stone_Red-C-Sharp-Utilities\\Stone_Red-C-Sharp-Utilities\\Stone_Red-C-Sharp-Utilities.csproj", "expectedPackageFiles": [],