-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Logger should create by LoggerProvider now
- Loading branch information
1 parent
258564b
commit 155f2e3
Showing
7 changed files
with
54 additions
and
100 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#if HAS_LOGGER | ||
// <copyright file="LoggerProvider.cs" company="The Android Open Source Project, Ryan Conrad, Quamotion, yungd1plomat, wherewhere"> | ||
// Copyright (c) The Android Open Source Project, Ryan Conrad, Quamotion, yungd1plomat, wherewhere. All rights reserved. | ||
// </copyright> | ||
|
||
namespace AdvancedSharpAdbClient | ||
{ | ||
/// <summary> | ||
/// Provides a mechanism for creating instances of <see cref="ILogger"/> and <see cref="ILogger{T}"/> classes. | ||
/// </summary> | ||
public static class LoggerProvider | ||
{ | ||
private static ILoggerFactory _loggerFactory = null; | ||
|
||
/// <summary> | ||
/// Sets the current log provider based on logger factory. | ||
/// </summary> | ||
/// <param name="loggerFactory">The logger factory.</param> | ||
public static void SetLogProvider(ILoggerFactory loggerFactory) => _loggerFactory = loggerFactory; | ||
|
||
/// <summary> | ||
/// Creates a new <see cref="ILogger"/> instance. | ||
/// </summary> | ||
/// <param name="category">The category name for messages produced by the logger.</param> | ||
/// <returns>A new <see cref="ILogger"/> instance.</returns> | ||
public static ILogger CreateLogger(string category) => _loggerFactory == null ? NullLogger.Instance : _loggerFactory.CreateLogger(category); | ||
|
||
/// <summary> | ||
/// Creates a new <see cref="ILogger"/> instance using the full name of the given type. | ||
/// </summary> | ||
/// <typeparam name="T">The type.</typeparam> | ||
/// <returns>The <see cref="ILogger"/> that was created</returns> | ||
public static ILogger<T> CreateLogger<T>() => _loggerFactory == null ? NullLogger<T>.Instance : _loggerFactory.CreateLogger<T>(); | ||
} | ||
} | ||
#endif |
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