C# Class JSNLog.Infrastructure.RequestId

Afficher le fichier Open project: mperdeck/jsnlog Class Usage Examples

Méthodes publiques

Méthode Description
GetLogRequestId ( this httpContext ) : string

Gets the request id from an HTTP header in the request. Every log request sent by jsnlog.js should have such a header. However, requests not sent by jsnlog.js will not have this header obviously. If the request id cannot be found, returns null.

GetLogRequestId ( string>.this headers ) : string
GetRequestId ( this httpContext ) : string

Gets an id, that is unique to this request. That is, for the same request, this method always returns the same string.

Private Methods

Méthode Description
CreateNewRequestId ( ) : string
GetRequestIdFromContext ( HttpContext httpContext ) : string
IISRequestId ( HttpContext httpContext ) : string

Creates an ID that is unique hopefully. This method initially tries to use the request id that IIS already uses internally. This allows us to correlate across even more log files. If this fails, for example if this is not part of a web request, than it uses a random GUID. See http://blog.tatham.oddie.com.au/2012/02/07/code-request-correlation-in-asp-net/

SetRequestIdInContext ( HttpContext httpContext, string requestId ) : void

Method Details

GetLogRequestId() public static méthode

Gets the request id from an HTTP header in the request. Every log request sent by jsnlog.js should have such a header. However, requests not sent by jsnlog.js will not have this header obviously. If the request id cannot be found, returns null.
public static GetLogRequestId ( this httpContext ) : string
httpContext this
Résultat string

GetLogRequestId() public static méthode

public static GetLogRequestId ( string>.this headers ) : string
headers string>.this
Résultat string

GetRequestId() public static méthode

Gets an id, that is unique to this request. That is, for the same request, this method always returns the same string.
public static GetRequestId ( this httpContext ) : string
httpContext this
Résultat string