Skip to content

Commit

Permalink
simplify method calls
Browse files Browse the repository at this point in the history
  • Loading branch information
ggnaegi committed Oct 19, 2023
1 parent f5ebacd commit d413201
Showing 1 changed file with 12 additions and 54 deletions.
66 changes: 12 additions & 54 deletions src/Ocelot/Logging/AspDotNetLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,65 +16,23 @@ public AspDotNetLogger(ILogger logger, IRequestScopedDataRepository scopedDataRe
_func = (state, exception) => exception == null ? state : $"{state}, exception: {exception}";
}

public void LogTrace(string message)
{
LogTrace(() => message);
}

public void LogTrace(Func<string> messageFactory)
{
WriteLog(LogLevel.Trace, messageFactory);
}

public void LogDebug(string message)
{
LogDebug(() => message);
}

public void LogDebug(Func<string> messageFactory)
{
WriteLog(LogLevel.Debug, messageFactory);
}

public void LogInformation(string message)
{
LogInformation(() => message);
}

public void LogInformation(Func<string> messageFactory)
{
WriteLog(LogLevel.Information, messageFactory);
}
public void LogTrace(string message) => LogTrace(() => message);
public void LogTrace(Func<string> messageFactory) => WriteLog(LogLevel.Trace, messageFactory);

public void LogWarning(string message)
{
LogWarning(() => message);
}
public void LogDebug(string message) => LogDebug(() => message);
public void LogDebug(Func<string> messageFactory) => WriteLog(LogLevel.Debug, messageFactory);

public void LogWarning(Func<string> messageFactory)
{
WriteLog(LogLevel.Warning, messageFactory);
}
public void LogInformation(string message) => LogInformation(() => message);
public void LogInformation(Func<string> messageFactory) => WriteLog(LogLevel.Information, messageFactory);

public void LogError(string message, Exception exception)
{
LogError(() => message, exception);
}
public void LogWarning(string message) => LogWarning(() => message);
public void LogWarning(Func<string> messageFactory) => WriteLog(LogLevel.Warning, messageFactory);

public void LogError(Func<string> messageFactory, Exception exception)
{
WriteLog(LogLevel.Error, messageFactory, exception);
}
public void LogError(string message, Exception exception) => LogError(() => message, exception);
public void LogError(Func<string> messageFactory, Exception exception) => WriteLog(LogLevel.Error, messageFactory, exception);

public void LogCritical(string message, Exception exception)
{
LogCritical(() => message, exception);
}

public void LogCritical(Func<string> messageFactory, Exception exception)
{
WriteLog(LogLevel.Critical, messageFactory, exception);
}
public void LogCritical(string message, Exception exception) => LogCritical(() => message, exception);
public void LogCritical(Func<string> messageFactory, Exception exception) => WriteLog(LogLevel.Critical, messageFactory, exception);

private string GetOcelotRequestId()
{
Expand Down

0 comments on commit d413201

Please sign in to comment.