-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
198d66c
commit b9e7765
Showing
43 changed files
with
7,977 additions
and
7,778 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
using System.Text.Json; | ||
using Microsoft.DevProxy.Abstractions; | ||
|
||
#pragma warning disable IDE0130 | ||
namespace Microsoft.Extensions.Logging; | ||
#pragma warning restore IDE0130 | ||
|
||
public static class ILoggerExtensions | ||
{ | ||
public static void LogRequest(this ILogger logger, string[] message, MessageType messageType, LoggingContext? context = null) | ||
{ | ||
logger.Log(new RequestLog(message, messageType, context)); | ||
} | ||
|
||
public static void LogRequest(this ILogger logger, string[] message, MessageType messageType, string method, string url) | ||
{ | ||
logger.Log(new RequestLog(message, messageType, method, url)); | ||
} | ||
|
||
public static void Log(this ILogger logger, RequestLog message) | ||
{ | ||
logger.Log(LogLevel.Information, 0, message, exception: null, (m, _) => JsonSerializer.Serialize(m)); | ||
} | ||
using System.Text.Json; | ||
using Microsoft.DevProxy.Abstractions; | ||
|
||
#pragma warning disable IDE0130 | ||
namespace Microsoft.Extensions.Logging; | ||
#pragma warning restore IDE0130 | ||
|
||
public static class ILoggerExtensions | ||
{ | ||
public static void LogRequest(this ILogger logger, string message, MessageType messageType, LoggingContext? context = null) | ||
{ | ||
logger.Log(new RequestLog(message, messageType, context)); | ||
} | ||
|
||
public static void LogRequest(this ILogger logger, string message, MessageType messageType, string method, string url) | ||
{ | ||
logger.Log(new RequestLog(message, messageType, method, url)); | ||
} | ||
|
||
public static void Log(this ILogger logger, RequestLog message) | ||
{ | ||
logger.Log(LogLevel.Information, 0, message, exception: null, (m, _) => JsonSerializer.Serialize(m)); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,32 +1,26 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
using Titanium.Web.Proxy.EventArguments; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace Microsoft.DevProxy.Abstractions; | ||
|
||
public enum MessageType | ||
{ | ||
Normal, | ||
InterceptedRequest, | ||
PassedThrough, | ||
Warning, | ||
Tip, | ||
Failed, | ||
Chaos, | ||
Mocked, | ||
InterceptedResponse, | ||
FinishedProcessingRequest | ||
} | ||
|
||
public class LoggingContext(SessionEventArgs session) | ||
{ | ||
public SessionEventArgs Session { get; } = session; | ||
} | ||
|
||
public interface IProxyLogger : ICloneable, ILogger | ||
{ | ||
public LogLevel LogLevel { get; set; } | ||
public void LogRequest(string[] message, MessageType messageType, LoggingContext? context = null); | ||
public void LogRequest(string[] message, MessageType messageType, string method, string url); | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using Titanium.Web.Proxy.EventArguments; | ||
|
||
namespace Microsoft.DevProxy.Abstractions; | ||
|
||
public enum MessageType | ||
{ | ||
Normal, | ||
InterceptedRequest, | ||
PassedThrough, | ||
Warning, | ||
Tip, | ||
Failed, | ||
Chaos, | ||
Mocked, | ||
InterceptedResponse, | ||
FinishedProcessingRequest, | ||
Skipped | ||
} | ||
|
||
public class LoggingContext(SessionEventArgs session) | ||
{ | ||
public SessionEventArgs Session { get; } = session; | ||
} |
Oops, something went wrong.