Skip to content

Commit

Permalink
[1.3.0] XML Documentation
Browse files Browse the repository at this point in the history
(+) XML Documentation Included
  • Loading branch information
Sargeras02 committed Jul 31, 2023
1 parent e81992e commit bd2b453
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 8 deletions.
55 changes: 53 additions & 2 deletions Model/LocalizedConsoleLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ namespace SKitLs.Utils.LocalLoggers.Model
/// </summary>
public class LocalizedConsoleLogger : DefaultConsoleLogger, ILocalizedLogger
{
/// <summary>
/// Represents the default language key used for localization within the logger.
/// It allows developers to set a default language for log messages, ensuring a consistent localization approach
/// across the application.
/// </summary>
public LangKey LoggerLanguage { get; set; }
/// <summary>
/// Denotes the specialized service responsible for handling the localization process and resolving localized strings.
/// </summary>
public ILocalizator Localizator { get; private set; }

/// <summary>
Expand All @@ -25,17 +33,60 @@ public class LocalizedConsoleLogger : DefaultConsoleLogger, ILocalizedLogger
/// <param name="localizator">Localization service that provides localized resources.</param>
public LocalizedConsoleLogger(ILocalizator localizator) => Localizator = localizator;

public void LLog(string mesKey, LogType type = LogType.Message, bool standsAlone = true, params string?[] format)
=> Log(Localizator.ResolveString(LoggerLanguage, mesKey, format), type, standsAlone);
/// <summary>
/// Logs localized custom message, resolving it by its <paramref name="mesKey"/>, with provided formatting rule <paramref name="logType"/>.
/// </summary>
/// <param name="mesKey">Message's key. Used to resolve message and log it.</param>
/// <param name="logType">Log type. Defines formatting rules.</param>
/// <param name="standsAlone">Determines whether message should be logged as a stand-alone one
/// (ex: NewLine for Console).</param>
/// <param name="format">Optional. An array of strings to be formatted into the resolved localized string.</param>
public void LLog(string mesKey, LogType logType = LogType.Message, bool standsAlone = true, params string?[] format)
=> Log(Localizator.ResolveString(LoggerLanguage, mesKey, format), logType, standsAlone);

/// <summary>
/// Logs localized custom message, resolving it by its <paramref name="mesKey"/>, as <see cref="LogType.Error"/> one.
/// </summary>
/// <param name="mesKey">Message's key. Used to resolve message and log it.</param>
/// <param name="standsAlone">Determines whether message should be logged as a stand-alone one
/// (ex: NewLine for Console).</param>
/// <param name="format">Optional. An array of strings to be formatted into the resolved localized string.</param>
public void LError(string mesKey, bool standsAlone = true, params string?[] format)
=> Error(Localizator.ResolveString(LoggerLanguage, mesKey, format), standsAlone);
/// <summary>
/// Logs localized custom message, resolving it by its <paramref name="mesKey"/>, as <see cref="LogType.Warning"/> one.
/// </summary>
/// <param name="mesKey">Message's key. Used to resolve message and log it.</param>
/// <param name="standsAlone">Determines whether message should be logged as a stand-alone one
/// (ex: NewLine for Console).</param>
/// <param name="format">Optional. An array of strings to be formatted into the resolved localized string.</param>
public void LWarn(string mesKey, bool standsAlone = true, params string?[] format)
=> Warn(Localizator.ResolveString(LoggerLanguage, mesKey, format), standsAlone);
/// <summary>
/// Logs localized custom message, resolving it by its <paramref name="mesKey"/>, as <see cref="LogType.Successful"/> one.
/// </summary>
/// <param name="mesKey">Message's key. Used to resolve message and log it.</param>
/// <param name="standsAlone">Determines whether message should be logged as a stand-alone one
/// (ex: NewLine for Console).</param>
/// <param name="format">Optional. An array of strings to be formatted into the resolved localized string.</param>
public void LSuccess(string mesKey, bool standsAlone = true, params string?[] format)
=> Success(Localizator.ResolveString(LoggerLanguage, mesKey, format), standsAlone);
/// <summary>
/// Logs localized custom message, resolving it by its <paramref name="mesKey"/>, as <see cref="LogType.System"/> one.
/// </summary>
/// <param name="mesKey">Message's key. Used to resolve message and log it.</param>
/// <param name="standsAlone">Determines whether message should be logged as a stand-alone one
/// (ex: NewLine for Console).</param>
/// <param name="format">Optional. An array of strings to be formatted into the resolved localized string.</param>
public void LSystem(string mesKey, bool standsAlone = true, params string?[] format)
=> System(Localizator.ResolveString(LoggerLanguage, mesKey, format), standsAlone);
/// <summary>
/// Logs localized custom message, resolving it by its <paramref name="mesKey"/>, as <see cref="LogType.Information"/> one.
/// </summary>
/// <param name="mesKey">Message's key. Used to resolve message and log it.</param>
/// <param name="standsAlone">Determines whether message should be logged as a stand-alone one
/// (ex: NewLine for Console).</param>
/// <param name="format">Optional. An array of strings to be formatted into the resolved localized string.</param>
public void LInform(string mesKey, bool standsAlone = true, params string?[] format)
=> Inform(Localizator.ResolveString(LoggerLanguage, mesKey, format), standsAlone);
}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ facilitating effective debugging.

Before running the project, please ensure that you have the following dependencies installed and properly configured in your development environment.

- SKitLs.Utils.Localizations 2.0.0 or higher
- SKitLs.Utils.Loggers 1.2.1 or higher
- SKitLs.Utils.Localizations 2.2.0 or higher
- SKitLs.Utils.Loggers 1.4.0 or higher

### Installation

Expand Down
9 changes: 5 additions & 4 deletions SKitLs.Utils.LocalLoggers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
<PackageIcon>libIcon_loclog.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageTags>Logging, DebuggingTools, Localization, Internationalization, Multilingual, Globalization</PackageTags>
<PackageReleaseNotes>README markup fix.</PackageReleaseNotes>
<AssemblyVersion>1.2.7.1</AssemblyVersion>
<PackageReleaseNotes>XML Docimentation Included</PackageReleaseNotes>
<AssemblyVersion>1.3.0</AssemblyVersion>
<FileVersion>$(AssemblyVersion)</FileVersion>
<Version>$(AssemblyVersion)</Version>
<Authors>Sargeras02, SKit-Labs</Authors>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
Expand All @@ -29,8 +30,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="SKitLs.Utils.Localizations" Version="2.0.0" />
<PackageReference Include="SKitLs.Utils.Loggers" Version="1.2.1" />
<PackageReference Include="SKitLs.Utils.Localizations" Version="2.2.0" />
<PackageReference Include="SKitLs.Utils.Loggers" Version="1.4.0" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit bd2b453

Please sign in to comment.