C# Class JSNLog.Infrastructure.RequestId

Mostra file Open project: mperdeck/jsnlog Class Usage Examples

Public Methods

Method 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

Method 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 method

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
return string

GetLogRequestId() public static method

public static GetLogRequestId ( string>.this headers ) : string
headers string>.this
return string

GetRequestId() public static method

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
return string