LogWrapper.cs
1 // Copyright (c) Microsoft Corporation 2 // The Microsoft Corporation licenses this file to you under the MIT license. 3 // See the LICENSE file in the project root for more information. 4 5 using ManagedCommon; 6 using Microsoft.CmdPal.Core.Common; 7 8 namespace Microsoft.CmdPal.UI; 9 10 internal sealed class LogWrapper : ILogger 11 { 12 public void LogError(string message, Exception ex, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "", [System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "", [System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0) 13 { 14 Logger.LogError(message, ex, memberName, sourceFilePath, sourceLineNumber); 15 } 16 17 public void LogError(string message, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "", [System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "", [System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0) 18 { 19 Logger.LogError(message, memberName, sourceFilePath, sourceLineNumber); 20 } 21 22 public void LogWarning(string message, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "", [System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "", [System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0) 23 { 24 Logger.LogWarning(message, memberName, sourceFilePath, sourceLineNumber); 25 } 26 27 public void LogInfo(string message, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "", [System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "", [System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0) 28 { 29 Logger.LogInfo(message, memberName, sourceFilePath, sourceLineNumber); 30 } 31 32 public void LogDebug(string message, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "", [System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "", [System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0) 33 { 34 Logger.LogDebug(message, memberName, sourceFilePath, sourceLineNumber); 35 } 36 37 public void LogTrace([System.Runtime.CompilerServices.CallerMemberName] string memberName = "", [System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "", [System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0) 38 { 39 Logger.LogTrace(memberName, sourceFilePath, sourceLineNumber); 40 } 41 }