mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add log error api function for csharp and jsonrpc
This commit is contained in:
parent
0e4e95a1b2
commit
6f0126d3ba
4 changed files with 16 additions and 11 deletions
|
|
@ -12,7 +12,7 @@ namespace Flow.Launcher.Core.Plugin.JsonRPCV2Models
|
|||
{
|
||||
public class JsonRPCPublicAPI
|
||||
{
|
||||
private IPublicAPI _api;
|
||||
private readonly IPublicAPI _api;
|
||||
|
||||
public JsonRPCPublicAPI(IPublicAPI api)
|
||||
{
|
||||
|
|
@ -104,7 +104,6 @@ namespace Flow.Launcher.Core.Plugin.JsonRPCV2Models
|
|||
return _api.GetAllPlugins();
|
||||
}
|
||||
|
||||
|
||||
public MatchResult FuzzySearch(string query, string stringToCompare)
|
||||
{
|
||||
return _api.FuzzySearch(query, stringToCompare);
|
||||
|
|
@ -156,6 +155,11 @@ namespace Flow.Launcher.Core.Plugin.JsonRPCV2Models
|
|||
_api.LogWarn(className, message, methodName);
|
||||
}
|
||||
|
||||
public void LogError(string className, string message, [CallerMemberName] string methodName = "")
|
||||
{
|
||||
_api.LogError(className, message, methodName);
|
||||
}
|
||||
|
||||
public void OpenDirectory(string DirectoryPath, string FileNameOrFilePath = null)
|
||||
{
|
||||
_api.OpenDirectory(DirectoryPath, FileNameOrFilePath);
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.ExceptionServices;
|
||||
using Flow.Launcher.Infrastructure.UserSettings;
|
||||
using NLog;
|
||||
using NLog.Config;
|
||||
using NLog.Targets;
|
||||
using Flow.Launcher.Infrastructure.UserSettings;
|
||||
using NLog.Targets.Wrappers;
|
||||
using System.Runtime.ExceptionServices;
|
||||
|
||||
namespace Flow.Launcher.Infrastructure.Logger
|
||||
{
|
||||
|
|
@ -135,13 +135,6 @@ namespace Flow.Launcher.Infrastructure.Logger
|
|||
return className;
|
||||
}
|
||||
|
||||
private static void ExceptionInternal(string classAndMethod, string message, System.Exception e)
|
||||
{
|
||||
var logger = LogManager.GetLogger(classAndMethod);
|
||||
|
||||
logger.Error(e, message);
|
||||
}
|
||||
|
||||
private static void LogInternal(string message, LogLevel level)
|
||||
{
|
||||
if (FormatValid(message))
|
||||
|
|
|
|||
|
|
@ -227,6 +227,11 @@ namespace Flow.Launcher.Plugin
|
|||
/// </summary>
|
||||
void LogWarn(string className, string message, [CallerMemberName] string methodName = "");
|
||||
|
||||
/// <summary>
|
||||
/// Log error message
|
||||
/// </summary>
|
||||
void LogError(string className, string message, [CallerMemberName] string methodName = "");
|
||||
|
||||
/// <summary>
|
||||
/// Log an Exception. Will throw if in debug mode so developer will be aware,
|
||||
/// otherwise logs the eror message. This is the primary logging method used for Flow
|
||||
|
|
|
|||
|
|
@ -187,6 +187,9 @@ namespace Flow.Launcher
|
|||
public void LogWarn(string className, string message, [CallerMemberName] string methodName = "") =>
|
||||
Log.Warn(className, message, methodName);
|
||||
|
||||
public void LogError(string className, string message, [CallerMemberName] string methodName = "") =>
|
||||
Log.Error(className, message, methodName);
|
||||
|
||||
public void LogException(string className, string message, Exception e,
|
||||
[CallerMemberName] string methodName = "") => Log.Exception(className, message, e, methodName);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue