-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bfb3014
commit 7c1a425
Showing
14 changed files
with
164 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
src/libs/SoloX.GeneratorTools.Core.CSharp.Extensions/Utils/InjectedGeneratorLogger.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// ---------------------------------------------------------------------- | ||
// <copyright file="InjectedGeneratorLogger.cs" company="Xavier Solau"> | ||
// Copyright © 2021 Xavier Solau. | ||
// Licensed under the MIT license. | ||
// See LICENSE file in the project root for full license information. | ||
// </copyright> | ||
// ---------------------------------------------------------------------- | ||
|
||
using SoloX.GeneratorTools.Core.Utils; | ||
using System; | ||
|
||
namespace SoloX.GeneratorTools.Core.CSharp.Extensions.Utils | ||
{ | ||
/// <summary> | ||
/// Injected GeneratorLogger wrapper that will use the injected IGeneratorLoggerFactory to make the target IGeneratorLogger. | ||
/// </summary> | ||
/// <typeparam name="TType"></typeparam> | ||
public class InjectedGeneratorLogger<TType> : IGeneratorLogger<TType> | ||
{ | ||
private readonly IGeneratorLogger<TType> logger; | ||
|
||
/// <summary> | ||
/// Setup GeneratorLogger through IoC. | ||
/// </summary> | ||
/// <param name="generatorLoggerFactory"></param> | ||
public InjectedGeneratorLogger(IGeneratorLoggerFactory generatorLoggerFactory) | ||
{ | ||
if (generatorLoggerFactory == null) | ||
{ | ||
throw new ArgumentNullException(nameof(generatorLoggerFactory)); | ||
} | ||
|
||
this.logger = generatorLoggerFactory.CreateLogger<TType>(); | ||
} | ||
|
||
/// <inheritdoc/> | ||
public void LogDebug(string message) | ||
{ | ||
this.logger.LogDebug(message); | ||
} | ||
|
||
/// <inheritdoc/> | ||
public void LogDebug(Exception exception, string message) | ||
{ | ||
this.logger.LogDebug(exception, message); | ||
} | ||
|
||
/// <inheritdoc/> | ||
public void LogError(string message) | ||
{ | ||
this.logger.LogError(message); | ||
} | ||
|
||
/// <inheritdoc/> | ||
public void LogError(Exception exception, string message) | ||
{ | ||
this.logger.LogError(exception, message); | ||
} | ||
|
||
/// <inheritdoc/> | ||
public void LogInformation(string message) | ||
{ | ||
this.logger.LogInformation(message); | ||
} | ||
|
||
/// <inheritdoc/> | ||
public void LogInformation(Exception exception, string message) | ||
{ | ||
this.logger.LogInformation(exception, message); | ||
} | ||
|
||
/// <inheritdoc/> | ||
public void LogWarning(string message) | ||
{ | ||
this.logger.LogWarning(message); | ||
} | ||
|
||
/// <inheritdoc/> | ||
public void LogWarning(Exception exception, string message) | ||
{ | ||
this.logger.LogWarning(exception, message); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.