Add event names for logs (#6818) (#4495)

* Add event names for logs (#6818)
This commit is contained in:
Pranav K 2018-12-08 13:00:16 +05:30 committed by GitHub
parent c612eb8730
commit 027bf336da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 147 additions and 152 deletions

View File

@ -156,407 +156,407 @@ namespace Microsoft.AspNetCore.Mvc
{
_actionExecuting = LoggerMessage.Define<string, string>(
LogLevel.Information,
1,
new EventId(1, "ActionExecuting"),
"Route matched with {RouteData}. Executing action {ActionName}");
_actionExecuted = LoggerMessage.Define<string, double>(
LogLevel.Information,
2,
new EventId(2, "ActionExecuted"),
"Executed action {ActionName} in {ElapsedMilliseconds}ms");
_pageExecuting = LoggerMessage.Define<string, string>(
LogLevel.Information,
3,
new EventId(3, "PageExecuting"),
"Route matched with {RouteData}. Executing page {PageName}");
_pageExecuted = LoggerMessage.Define<string, double>(
LogLevel.Information,
4,
new EventId(4, "PageExecuted"),
"Executed page {PageName} in {ElapsedMilliseconds}ms");
_challengeResultExecuting = LoggerMessage.Define<string[]>(
LogLevel.Information,
1,
new EventId(1, "ChallengeResultExecuting"),
"Executing ChallengeResult with authentication schemes ({Schemes}).");
_contentResultExecuting = LoggerMessage.Define<string>(
LogLevel.Information,
1,
new EventId(1, "ContentResultExecuting"),
"Executing ContentResult with HTTP Response ContentType of {ContentType}");
_actionMethodExecuting = LoggerMessage.Define<string, ModelValidationState>(
LogLevel.Information,
1,
new EventId(1, "ActionMethodExecuting"),
"Executing action method {ActionName} - Validation state: {ValidationState}");
_actionMethodExecutingWithArguments = LoggerMessage.Define<string, string[], ModelValidationState>(
LogLevel.Information,
1,
new EventId(1, "ActionMethodExecutingWithArguments"),
"Executing action method {ActionName} with arguments ({Arguments}) - Validation state: {ValidationState}");
_actionMethodExecuted = LoggerMessage.Define<string, string, double>(
LogLevel.Information,
2,
new EventId(2, "ActionMethodExecuted"),
"Executed action method {ActionName}, returned result {ActionResult} in {ElapsedMilliseconds}ms.");
_logFilterExecutionPlan = LoggerMessage.Define<string, string[]>(
LogLevel.Debug,
1,
new EventId(1, "FilterExecutionPlan"),
"Execution plan of {FilterType} filters (in the following order): {Filters}");
_beforeExecutingMethodOnFilter = LoggerMessage.Define<string, string, Type>(
LogLevel.Trace,
2,
new EventId(2, "BeforeExecutingMethodOnFilter"),
"{FilterType}: Before executing {Method} on filter {Filter}.");
_afterExecutingMethodOnFilter = LoggerMessage.Define<string, string, Type>(
LogLevel.Trace,
3,
new EventId(3, "AfterExecutingMethodOnFilter"),
"{FilterType}: After executing {Method} on filter {Filter}.");
_beforeExecutingActionResult = LoggerMessage.Define<Type>(
LogLevel.Trace,
4,
new EventId(4, "BeforeExecutingActionResult"),
"Before executing action result {ActionResult}.");
_afterExecutingActionResult = LoggerMessage.Define<Type>(
LogLevel.Trace,
5,
new EventId(5, "AfterExecutingActionResult"),
"After executing action result {ActionResult}.");
_ambiguousActions = LoggerMessage.Define<string>(
LogLevel.Error,
1,
new EventId(1, "AmbiguousActions"),
"Request matched multiple actions resulting in ambiguity. Matching actions: {AmbiguousActions}");
_constraintMismatch = LoggerMessage.Define<string, string, IActionConstraint>(
LogLevel.Debug,
2,
new EventId(2, "ConstraintMismatch"),
"Action '{ActionName}' with id '{ActionId}' did not match the constraint '{ActionConstraint}'");
_executingFileResult = LoggerMessage.Define<FileResult, string, string>(
LogLevel.Information,
1,
new EventId(1, "ExecutingFileResult"),
"Executing {FileResultType}, sending file '{FileDownloadPath}' with download name '{FileDownloadName}' ...");
_executingFileResultWithNoFileName = LoggerMessage.Define<FileResult, string>(
LogLevel.Information,
2,
new EventId(2, "ExecutingFileResultWithNoFileName"),
"Executing {FileResultType}, sending file with download name '{FileDownloadName}' ...");
_authorizationFailure = LoggerMessage.Define<object>(
LogLevel.Information,
3,
new EventId(3, "AuthorizationFailure"),
"Authorization failed for the request at filter '{AuthorizationFilter}'.");
_resourceFilterShortCircuit = LoggerMessage.Define<object>(
LogLevel.Debug,
4,
new EventId(4, "ResourceFilterShortCircuit"),
"Request was short circuited at resource filter '{ResourceFilter}'.");
_resultFilterShortCircuit = LoggerMessage.Define<object>(
LogLevel.Debug,
5,
new EventId(5, "ResultFilterShortCircuit"),
"Request was short circuited at result filter '{ResultFilter}'.");
_actionFilterShortCircuit = LoggerMessage.Define<object>(
LogLevel.Debug,
3,
new EventId(3, "ActionFilterShortCircuit"),
"Request was short circuited at action filter '{ActionFilter}'.");
_exceptionFilterShortCircuit = LoggerMessage.Define<object>(
LogLevel.Debug,
4,
new EventId(4, "ExceptionFilterShortCircuit"),
"Request was short circuited at exception filter '{ExceptionFilter}'.");
_forbidResultExecuting = LoggerMessage.Define<string[]>(
LogLevel.Information,
eventId: 1,
new EventId(1, "ForbidResultExecuting"),
formatString: $"Executing {nameof(ForbidResult)} with authentication schemes ({{Schemes}}).");
_signInResultExecuting = LoggerMessage.Define<string, ClaimsPrincipal>(
LogLevel.Information,
eventId: 1,
new EventId(1, "SignInResultExecuting"),
formatString: $"Executing {nameof(SignInResult)} with authentication scheme ({{Scheme}}) and the following principal: {{Principal}}.");
_signOutResultExecuting = LoggerMessage.Define<string[]>(
LogLevel.Information,
eventId: 1,
new EventId(1, "SignOutResultExecuting"),
formatString: $"Executing {nameof(SignOutResult)} with authentication schemes ({{Schemes}}).");
_httpStatusCodeResultExecuting = LoggerMessage.Define<int>(
LogLevel.Information,
1,
new EventId(1, "HttpStatusCodeResultExecuting"),
"Executing HttpStatusCodeResult, setting HTTP status code {StatusCode}");
_localRedirectResultExecuting = LoggerMessage.Define<string>(
LogLevel.Information,
1,
new EventId(1, "LocalRedirectResultExecuting"),
"Executing LocalRedirectResult, redirecting to {Destination}.");
_noFormatter = LoggerMessage.Define<string>(
LogLevel.Warning,
1,
new EventId(1, "NoFormatter"),
"No output formatter was found for content type '{ContentType}' to write the response.");
_objectResultExecuting = LoggerMessage.Define<string>(
LogLevel.Information,
1,
new EventId(1, "ObjectResultExecuting"),
"Executing ObjectResult, writing value of type '{Type}'.");
_formatterSelected = LoggerMessage.Define<IOutputFormatter, string>(
LogLevel.Debug,
2,
new EventId(2, "FormatterSelected"),
"Selected output formatter '{OutputFormatter}' and content type '{ContentType}' to write the response.");
_skippedContentNegotiation = LoggerMessage.Define<string>(
LogLevel.Debug,
3,
new EventId(3, "SkippedContentNegotiation"),
"Skipped content negotiation as content type '{ContentType}' is explicitly set for the response.");
_noAcceptForNegotiation = LoggerMessage.Define(
LogLevel.Debug,
4,
new EventId(4, "NoAcceptForNegotiation"),
"No information found on request to perform content negotiation.");
_noFormatterFromNegotiation = LoggerMessage.Define<IEnumerable<MediaTypeSegmentWithQuality>>(
LogLevel.Debug,
5,
new EventId(5, "NoFormatterFromNegotiation"),
"Could not find an output formatter based on content negotiation. Accepted types were ({AcceptTypes})");
_inputFormatterSelected = LoggerMessage.Define<IInputFormatter, string>(
LogLevel.Debug,
1,
new EventId(1, "InputFormatterSelected"),
"Selected input formatter '{InputFormatter}' for content type '{ContentType}'.");
_inputFormatterRejected = LoggerMessage.Define<IInputFormatter, string>(
LogLevel.Debug,
2,
new EventId(2, "InputFormatterRejected"),
"Rejected input formatter '{InputFormatter}' for content type '{ContentType}'.");
_noInputFormatterSelected = LoggerMessage.Define<string>(
LogLevel.Debug,
3,
new EventId(3, "NoInputFormatterSelected"),
"No input formatter was found to support the content type '{ContentType}' for use with the [FromBody] attribute.");
_removeFromBodyAttribute = LoggerMessage.Define<string, string>(
LogLevel.Debug,
4,
new EventId(4, "RemoveFromBodyAttribute"),
"To use model binding, remove the [FromBody] attribute from the property or parameter named '{ModelName}' with model type '{ModelType}'.");
_redirectResultExecuting = LoggerMessage.Define<string>(
LogLevel.Information,
1,
new EventId(1, "RedirectResultExecuting"),
"Executing RedirectResult, redirecting to {Destination}.");
_redirectToActionResultExecuting = LoggerMessage.Define<string>(
LogLevel.Information,
1,
new EventId(1, "RedirectToActionResultExecuting"),
"Executing RedirectResult, redirecting to {Destination}.");
_redirectToRouteResultExecuting = LoggerMessage.Define<string, string>(
LogLevel.Information,
1,
new EventId(1, "RedirectToRouteResultExecuting"),
"Executing RedirectToRouteResult, redirecting to {Destination} from route {RouteName}.");
_redirectToPageResultExecuting = LoggerMessage.Define<string>(
LogLevel.Information,
1,
new EventId(1, "RedirectToPageResultExecuting"),
"Executing RedirectToPageResult, redirecting to {Page}.");
_noActionsMatched = LoggerMessage.Define<string[]>(
LogLevel.Debug,
3,
new EventId(3, "NoActionsMatched"),
"No actions matched the current request. Route values: {RouteValues}");
_featureNotFound = LoggerMessage.Define(
LogLevel.Warning,
1,
new EventId(1, "FeatureNotFound"),
"A request body size limit could not be applied. This server does not support the IHttpRequestBodySizeFeature.");
_featureIsReadOnly = LoggerMessage.Define(
LogLevel.Warning,
2,
new EventId(2, "FeatureIsReadOnly"),
"A request body size limit could not be applied. The IHttpRequestBodySizeFeature for the server is read-only.");
_maxRequestBodySizeSet = LoggerMessage.Define<string>(
LogLevel.Debug,
3,
new EventId(3, "MaxRequestBodySizeSet"),
"The maximum request body size has been set to {RequestSize}.");
_requestBodySizeLimitDisabled = LoggerMessage.Define(
LogLevel.Debug,
3,
new EventId(3, "RequestBodySizeLimitDisabled"),
"The request body size limit has been disabled.");
_cannotApplyRequestFormLimits = LoggerMessage.Define(
LogLevel.Warning,
1,
new EventId(1, "CannotApplyRequestFormLimits"),
"Unable to apply configured form options since the request form has already been read.");
_appliedRequestFormLimits = LoggerMessage.Define(
LogLevel.Debug,
2,
new EventId(2, "AppliedRequestFormLimits"),
"Applied the configured form options on the current request.");
_modelStateInvalidFilterExecuting = LoggerMessage.Define(
LogLevel.Debug,
1,
new EventId(1, "ModelStateInvalidFilterExecuting"),
"The request has model state errors, returning an error response.");
_inferredParameterSource = LoggerMessage.Define<MethodInfo, string, string>(
LogLevel.Debug,
1,
new EventId(1, "InferredParameterSource"),
"Inferred binding source for '{ParameterName}` on `{ActionName}` as {BindingSource}.");
_unsupportedFormatFilterContentType = LoggerMessage.Define<string>(
LogLevel.Debug,
1,
new EventId(1, "UnsupportedFormatFilterContentType"),
"Could not find a media type for the format '{FormatFilterContentType}'.");
_actionDoesNotSupportFormatFilterContentType = LoggerMessage.Define<string, MediaTypeCollection>(
LogLevel.Debug,
2,
new EventId(2, "ActionDoesNotSupportFormatFilterContentType"),
"Current action does not support the content type '{FormatFilterContentType}'. The supported content types are '{SupportedMediaTypes}'.");
_cannotApplyFormatFilterContentType = LoggerMessage.Define<string>(
LogLevel.Debug,
3,
new EventId(3, "CannotApplyFormatFilterContentType"),
"Cannot apply content type '{FormatFilterContentType}' to the response as current action had explicitly set a preferred content type.");
_notMostEffectiveFilter = LoggerMessage.Define<Type, Type, Type>(
LogLevel.Debug,
4,
new EventId(4, "NotMostEffectiveFilter"),
"Execution of filter {OverriddenFilter} is preempted by filter {OverridingFilter} which is the most effective filter implementing policy {FilterPolicy}.");
_actionDoesNotExplicitlySpecifyContentTypes = LoggerMessage.Define(
LogLevel.Debug,
5,
new EventId(5, "ActionDoesNotExplicitlySpecifyContentTypes"),
"Current action does not explicitly specify any content types for the response.");
_selectingOutputFormatterUsingAcceptHeader = LoggerMessage.Define<IEnumerable<MediaTypeSegmentWithQuality>>(
LogLevel.Debug,
6,
new EventId(6, "SelectingOutputFormatterUsingAcceptHeader"),
"Attempting to select an output formatter based on Accept header '{AcceptHeader}'.");
_selectingOutputFormatterUsingAcceptHeaderAndExplicitContentTypes = LoggerMessage.Define<IEnumerable<MediaTypeSegmentWithQuality>, MediaTypeCollection>(
LogLevel.Debug,
7,
new EventId(7, "SelectingOutputFormatterUsingAcceptHeaderAndExplicitContentTypes"),
"Attempting to select an output formatter based on Accept header '{AcceptHeader}' and explicitly specified content types '{ExplicitContentTypes}'. The content types in the accept header must be a subset of the explicitly set content types.");
_selectingOutputFormatterWithoutUsingContentTypes = LoggerMessage.Define(
LogLevel.Debug,
8,
new EventId(8, "SelectingOutputFormatterWithoutUsingContentTypes"),
"Attempting to select an output formatter without using a content type as no explicit content types were specified for the response.");
_selectingOutputFormatterUsingContentTypes = LoggerMessage.Define<MediaTypeCollection>(
LogLevel.Debug,
9,
new EventId(9, "SelectingOutputFormatterUsingContentTypes"),
"Attempting to select the first output formatter in the output formatters list which supports a content type from the explicitly specified content types '{ExplicitContentTypes}'.");
_selectingFirstCanWriteFormatter = LoggerMessage.Define(
LogLevel.Debug,
10,
new EventId(10, "SelectingFirstCanWriteFormatter"),
"Attempting to select the first formatter in the output formatters list which can write the result.");
_registeredOutputFormatters = LoggerMessage.Define<IEnumerable<IOutputFormatter>>(
LogLevel.Debug,
11,
new EventId(11, "RegisteredOutputFormatters"),
"List of registered output formatters, in the following order: {OutputFormatters}");
_writingRangeToBody = LoggerMessage.Define(
LogLevel.Debug,
17,
new EventId(17, "WritingRangeToBody"),
"Writing the requested range of bytes to the body...");
_registeredModelBinderProviders = LoggerMessage.Define<IModelBinderProvider[]>(
LogLevel.Debug,
12,
new EventId(12, "RegisteredModelBinderProviders"),
"Registered model binder providers, in the following order: {ModelBinderProviders}");
_attemptingToBindPropertyModel = LoggerMessage.Define<Type, string, Type, string>(
LogLevel.Debug,
13,
new EventId(13, "AttemptingToBindPropertyModel"),
"Attempting to bind property '{PropertyContainerType}.{PropertyName}' of type '{ModelType}' using the name '{ModelName}' in request data ...");
_doneAttemptingToBindPropertyModel = LoggerMessage.Define<Type, string, Type>(
LogLevel.Debug,
14,
new EventId(14, "DoneAttemptingToBindPropertyModel"),
"Done attempting to bind property '{PropertyContainerType}.{PropertyName}' of type '{ModelType}'.");
_foundNoValueForPropertyInRequest = LoggerMessage.Define<string, Type, string, Type>(
LogLevel.Debug,
15,
new EventId(15, "FoundNoValueForPropertyInRequest"),
"Could not find a value in the request with name '{ModelName}' for binding property '{PropertyContainerType}.{ModelFieldName}' of type '{ModelType}'.");
_foundNoValueForParameterInRequest = LoggerMessage.Define<string, string, Type>(
LogLevel.Debug,
16,
new EventId(16, "FoundNoValueForParameterInRequest"),
"Could not find a value in the request with name '{ModelName}' for binding parameter '{ModelFieldName}' of type '{ModelType}'.");
_noPublicSettableProperties = LoggerMessage.Define<string, Type>(
LogLevel.Debug,
17,
new EventId(17, "NoPublicSettableProperties"),
"Could not bind to model with name '{ModelName}' and type '{ModelType}' as the type has no public settable properties.");
_cannotBindToComplexType = LoggerMessage.Define<Type>(
LogLevel.Debug,
18,
new EventId(18, "CannotBindToComplexType"),
"Could not bind to model of type '{ModelType}' as there were no values in the request for any of the properties.");
_cannotBindToFilesCollectionDueToUnsupportedContentType = LoggerMessage.Define<string, Type>(
LogLevel.Debug,
19,
new EventId(19, "CannotBindToFilesCollectionDueToUnsupportedContentType"),
"Could not bind to model with name '{ModelName}' and type '{ModelType}' as the request did not have a content type of either 'application/x-www-form-urlencoded' or 'multipart/form-data'.");
_cannotCreateHeaderModelBinder = LoggerMessage.Define<Type>(
LogLevel.Debug,
20,
new EventId(20, "CannotCreateHeaderModelBinder"),
"Could not create a binder for type '{ModelType}' as this binder only supports simple types (like string, int, bool, enum) or a collection of simple types.");
_noFilesFoundInRequest = LoggerMessage.Define(
LogLevel.Debug,
21,
new EventId(21, "NoFilesFoundInRequest"),
"No files found in the request to bind the model to.");
_attemptingToBindParameter = LoggerMessage.Define<string, Type>(
LogLevel.Debug,
22,
new EventId(22, "AttemptingToBindParameter"),
"Attempting to bind parameter '{ParameterName}' of type '{ModelType}' ...");
_doneAttemptingToBindParameter = LoggerMessage.Define<string, Type>(
LogLevel.Debug,
23,
new EventId(23, "DoneAttemptingToBindParameter"),
"Done attempting to bind parameter '{ParameterName}' of type '{ModelType}'.");
_attemptingToBindModel = LoggerMessage.Define<Type, string>(
LogLevel.Debug,
24,
new EventId(24, "AttemptingToBindModel"),
"Attempting to bind model of type '{ModelType}' using the name '{ModelName}' in request data ...");
_doneAttemptingToBindModel = LoggerMessage.Define<Type, string>(
LogLevel.Debug,
25,
new EventId(25, "DoneAttemptingToBindModel"),
"Done attempting to bind model of type '{ModelType}' using the name '{ModelName}'.");
_attemptingToValidateParameter = LoggerMessage.Define<string, Type>(
LogLevel.Debug,
26,
new EventId(26, "AttemptingToValidateParameter"),
"Attempting to validate the bound parameter '{ParameterName}' of type '{ModelType}' ...");
_doneAttemptingToValidateParameter = LoggerMessage.Define<string, Type>(
LogLevel.Debug,
27,
new EventId(27, "DoneAttemptingToValidateParameter"),
"Done attempting to validate the bound parameter '{ParameterName}' of type '{ModelType}'.");
_noNonIndexBasedFormatFoundForCollection = LoggerMessage.Define<string, string>(
LogLevel.Debug,
28,
new EventId(28, "NoNonIndexBasedFormatFoundForCollection"),
"Could not bind to collection using a format like {ModelName}=value1&{ModelName}=value2");
_attemptingToBindCollectionUsingIndices = LoggerMessage.Define<string, string, string, string, string, string>(
LogLevel.Debug,
29,
new EventId(29, "AttemptingToBindCollectionUsingIndices"),
"Attempting to bind model using indices. Example formats include: " +
"[0]=value1&[1]=value2, " +
"{ModelName}[0]=value1&{ModelName}[1]=value2, " +
@ -564,7 +564,7 @@ namespace Microsoft.AspNetCore.Mvc
_attemptingToBindCollectionOfKeyValuePair = LoggerMessage.Define<string, string, string, string, string, string>(
LogLevel.Debug,
30,
new EventId(30, "AttemptingToBindCollectionOfKeyValuePair"),
"Attempting to bind collection of KeyValuePair. Example formats include: " +
"[0].Key=key1&[0].Value=value1&[1].Key=key2&[1].Value=value2, " +
"{ModelName}[0].Key=key1&{ModelName}[0].Value=value1&{ModelName}[1].Key=key2&{ModelName}[1].Value=value2, " +
@ -572,82 +572,82 @@ namespace Microsoft.AspNetCore.Mvc
_noKeyValueFormatForDictionaryModelBinder = LoggerMessage.Define<string, string, string>(
LogLevel.Debug,
33,
new EventId(33, "NoKeyValueFormatForDictionaryModelBinder"),
"Attempting to bind model with name '{ModelName}' using the format {ModelName}[key1]=value1&{ModelName}[key2]=value2");
_ifMatchPreconditionFailed = LoggerMessage.Define<EntityTagHeaderValue>(
LogLevel.Debug,
34,
new EventId(34, "IfMatchPreconditionFailed"),
"Current request's If-Match header check failed as the file's current etag '{CurrentETag}' does not match with any of the supplied etags.");
_ifUnmodifiedSincePreconditionFailed = LoggerMessage.Define<DateTimeOffset?, DateTimeOffset?>(
LogLevel.Debug,
35,
new EventId(35, "IfUnmodifiedSincePreconditionFailed"),
"Current request's If-Unmodified-Since header check failed as the file was modified (at '{lastModified}') after the If-Unmodified-Since date '{IfUnmodifiedSinceDate}'.");
_ifRangeLastModifiedPreconditionFailed = LoggerMessage.Define<DateTimeOffset?, DateTimeOffset?>(
LogLevel.Debug,
36,
new EventId(36, "IfRangeLastModifiedPreconditionFailed"),
"Could not serve range as the file was modified (at {LastModified}) after the if-Range's last modified date '{IfRangeLastModified}'.");
_ifRangeETagPreconditionFailed = LoggerMessage.Define<EntityTagHeaderValue, EntityTagHeaderValue>(
LogLevel.Debug,
37,
new EventId(37, "IfRangeETagPreconditionFailed"),
"Could not serve range as the file's current etag '{CurrentETag}' does not match the If-Range etag '{IfRangeETag}'.");
_notEnabledForRangeProcessing = LoggerMessage.Define(
LogLevel.Debug,
38,
new EventId(38, "NotEnabledForRangeProcessing"),
$"The file result has not been enabled for processing range requests. To enable it, set the property '{nameof(FileResult.EnableRangeProcessing)}' on the result to 'true'.");
_attemptingToBindProperty = LoggerMessage.Define<Type, string, Type>(
LogLevel.Debug,
39,
new EventId(39, "AttemptingToBindProperty"),
"Attempting to bind property '{PropertyContainerType}.{PropertyName}' of type '{ModelType}' ...");
_doneAttemptingToBindProperty = LoggerMessage.Define<Type, string, Type>(
LogLevel.Debug,
40,
new EventId(40, "DoneAttemptingToBindProperty"),
"Done attempting to bind property '{PropertyContainerType}.{PropertyName}' of type '{ModelType}'.");
_attemptingToValidateProperty = LoggerMessage.Define<Type, string, Type>(
LogLevel.Debug,
41,
new EventId(41, "AttemptingToValidateProperty"),
"Attempting to validate the bound property '{PropertyContainerType}.{PropertyName}' of type '{ModelType}' ...");
_doneAttemptingToValidateProperty = LoggerMessage.Define<Type, string, Type>(
LogLevel.Debug,
42,
new EventId(42, "DoneAttemptingToValidateProperty"),
"Done attempting to validate the bound property '{PropertyContainerType}.{PropertyName}' of type '{ModelType}'.");
_cannotCreateHeaderModelBinderCompatVersion_2_0 = LoggerMessage.Define<Type>(
LogLevel.Debug,
43,
new EventId(43, "CannotCreateHeaderModelBinderCompatVersion20"),
"Could not create a binder for type '{ModelType}' as this binder only supports 'System.String' type or a collection of 'System.String'.");
_attemptingToBindParameterModel = LoggerMessage.Define<string, Type, string>(
LogLevel.Debug,
44,
new EventId(44, "AttemptingToBindParameterModel"),
"Attempting to bind parameter '{ParameterName}' of type '{ModelType}' using the name '{ModelName}' in request data ...");
_doneAttemptingToBindParameterModel = LoggerMessage.Define<string, Type>(
LogLevel.Debug,
45,
new EventId(45, "DoneAttemptingToBindParameterModel"),
"Done attempting to bind parameter '{ParameterName}' of type '{ModelType}'.");
_foundNoValueInRequest = LoggerMessage.Define<string, Type>(
LogLevel.Debug,
46,
new EventId(46, "FoundNoValueInRequest"),
"Could not find a value in the request with name '{ModelName}' of type '{ModelType}'.");
_parameterBinderRequestPredicateShortCircuitOfProperty = LoggerMessage.Define<Type, string>(
LogLevel.Debug,
47,
new EventId(47, "ParameterBinderRequestPredicateShortCircuitOfProperty"),
"Skipped binding property '{PropertyContainerType}.{PropertyName}' since its binding information disallowed it for the current request.");
_parameterBinderRequestPredicateShortCircuitOfParameter = LoggerMessage.Define<string>(
LogLevel.Debug,
48,
new EventId(48, "ParameterBinderRequestPredicateShortCircuitOfParameter"),
"Skipped binding parameter '{ParameterName}' since its binding information disallowed it for the current request.");
_transformingClientError = LoggerMessage.Define<Type, int?, Type>(

View File

@ -14,7 +14,7 @@ namespace Microsoft.AspNetCore.Mvc.Cors
{
_notMostEffectiveFilter = LoggerMessage.Define<Type>(
LogLevel.Debug,
1,
new EventId(1, nameof(NotMostEffectiveFilter)),
"Skipping the execution of current filter as its not the most effective filter implementing the policy {FilterPolicy}.");
}

View File

@ -16,12 +16,12 @@ namespace Microsoft.AspNetCore.Mvc.Formatters
{
_jsonInputFormatterCrashed = LoggerMessage.Define(
LogLevel.Debug,
1,
new EventId(1, nameof(JsonInputException)),
"JSON input formatter threw an exception.");
_jsonResultExecuting = LoggerMessage.Define<string>(
LogLevel.Information,
1,
new EventId(1, nameof(JsonResultExecuting)),
"Executing JsonResult, writing value of type '{Type}'.");
}

View File

@ -15,12 +15,12 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
{
_failedToCreateXmlSerializer = LoggerMessage.Define<string>(
LogLevel.Warning,
1,
new EventId(1, nameof(FailedToCreateXmlSerializer)),
"An error occurred while trying to create an XmlSerializer for the type '{Type}'.");
_failedToCreateDataContractSerializer = LoggerMessage.Define<string>(
LogLevel.Warning,
2,
new EventId(2, nameof(FailedToCreateDataContractSerializer)),
"An error occurred while trying to create a DataContractSerializer for the type '{Type}'.");
}
@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Xml
{
_failedToCreateXmlSerializer(logger, typeName, exception);
}
public static void FailedToCreateDataContractSerializer(this ILogger logger, string typeName, Exception exception)
{
_failedToCreateDataContractSerializer(logger, typeName, exception);

View File

@ -36,87 +36,82 @@ namespace Microsoft.AspNetCore.Mvc.Razor
{
_viewCompilerStartCodeGeneration = LoggerMessage.Define<string>(
LogLevel.Debug,
1,
new EventId(1, nameof(ViewCompilerStartCodeGeneration)),
"Code generation for the Razor file at '{FilePath}' started.");
_viewCompilerEndCodeGeneration = LoggerMessage.Define<string, double>(
LogLevel.Debug,
2,
new EventId(2, nameof(ViewCompilerEndCodeGeneration)),
"Code generation for the Razor file at '{FilePath}' completed in {ElapsedMilliseconds}ms.");
_viewCompilerLocatedCompiledView = LoggerMessage.Define<string>(
LogLevel.Debug,
3,
new EventId(3, nameof(ViewCompilerLocatedCompiledView)),
"Initializing Razor view compiler with compiled view: '{ViewName}'.");
_viewCompilerNoCompiledViewsFound = LoggerMessage.Define(
LogLevel.Debug,
4,
new EventId(4, nameof(ViewCompilerNoCompiledViewsFound)),
"Initializing Razor view compiler with no compiled views.");
_viewCompilerLocatedCompiledViewForPath = LoggerMessage.Define<string>(
LogLevel.Trace,
5,
"Located compiled view for view at path '{Path}'.");
_viewCompilerLocatedCompiledViewForPath = LoggerMessage.Define<string>(
LogLevel.Trace,
5,
new EventId(5, nameof(ViewCompilerLocatedCompiledViewForPath)),
"Located compiled view for view at path '{Path}'.");
_viewCompilerRecompilingCompiledView = LoggerMessage.Define<string>(
LogLevel.Trace,
6,
new EventId(6, "ViewCompilerRecompilingCompiledView"),
"Invalidating compiled view for view at path '{Path}'.");
_viewCompilerCouldNotFindFileToCompileForPath = LoggerMessage.Define<string>(
LogLevel.Trace,
7,
new EventId(7, nameof(ViewCompilerCouldNotFindFileAtPath)),
"Could not find a file for view at path '{Path}'.");
_viewCompilerFoundFileToCompileForPath = LoggerMessage.Define<string>(
LogLevel.Trace,
8,
new EventId(8, nameof(ViewCompilerFoundFileToCompile)),
"Found file at path '{Path}'.");
_viewCompilerInvalidatingCompiledFile = LoggerMessage.Define<string>(
LogLevel.Trace,
9,
new EventId(9, nameof(ViewCompilerInvalidingCompiledFile)),
"Invalidating compiled view at path '{Path}' with a file since the checksum did not match.");
_viewLookupCacheMiss = LoggerMessage.Define<string, string>(
LogLevel.Debug,
1,
new EventId(1, nameof(ViewLookupCacheMiss)),
"View lookup cache miss for view '{ViewName}' in controller '{ControllerName}'.");
_viewLookupCacheHit = LoggerMessage.Define<string, string>(
LogLevel.Debug,
2,
new EventId(2, nameof(ViewLookupCacheHit)),
"View lookup cache hit for view '{ViewName}' in controller '{ControllerName}'.");
_precompiledViewFound = LoggerMessage.Define<string>(
LogLevel.Debug,
3,
new EventId(3, nameof(PrecompiledViewFound)),
"Using precompiled view for '{RelativePath}'.");
_generatedCodeToAssemblyCompilationStart = LoggerMessage.Define<string>(
LogLevel.Debug,
1,
new EventId(1, nameof(GeneratedCodeToAssemblyCompilationStart)),
"Compilation of the generated code for the Razor file at '{FilePath}' started.");
_generatedCodeToAssemblyCompilationEnd = LoggerMessage.Define<string, double>(
LogLevel.Debug,
2,
new EventId(2, nameof(GeneratedCodeToAssemblyCompilationEnd)),
"Compilation of the generated code for the Razor file at '{FilePath}' completed in {ElapsedMilliseconds}ms.");
_tagHelperComponentInitialized = LoggerMessage.Define<string>(
LogLevel.Debug,
2,
new EventId(2, nameof(TagHelperComponentInitialized)),
"Tag helper component '{ComponentName}' initialized.");
_tagHelperComponentProcessed = LoggerMessage.Define<string>(
LogLevel.Debug,
3,
new EventId(3, nameof(TagHelperComponentProcessed)),
"Tag helper component '{ComponentName}' processed.");
}

View File

@ -30,52 +30,52 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
_handlerMethodExecuting = LoggerMessage.Define<string, string[], ModelValidationState>(
LogLevel.Information,
101,
new EventId(101, nameof(ExecutingHandlerMethod)),
"Executing handler method {HandlerName} with arguments ({Arguments}) - ModelState is {ValidationState}");
_handlerMethodExecuted = LoggerMessage.Define<string, string>(
LogLevel.Information,
102,
new EventId(102, nameof(ExecutedHandlerMethod)),
"Executed handler method {HandlerName}, returned result {ActionResult}.");
_implicitHandlerMethodExecuting = LoggerMessage.Define<ModelValidationState>(
LogLevel.Information,
103,
new EventId(103, nameof(ExecutingImplicitHandlerMethod)),
"Executing an implicit handler method - ModelState is {ValidationState}");
_implicitHandlerMethodExecuted = LoggerMessage.Define<string>(
LogLevel.Information,
104,
new EventId(104, nameof(ExecutedImplicitHandlerMethod)),
"Executed an implicit handler method, returned result {ActionResult}.");
_pageFilterShortCircuit = LoggerMessage.Define<object>(
LogLevel.Debug,
3,
new EventId(3, nameof(PageFilterShortCircuited)),
"Request was short circuited at page filter '{PageFilter}'.");
_malformedPageDirective = LoggerMessage.Define<string, string[]>(
LogLevel.Warning,
104,
new EventId(104, "MalformedPageDirective"),
"The page directive at '{FilePath}' is malformed. Please fix the following issues: {Diagnostics}");
_notMostEffectiveFilter = LoggerMessage.Define<Type>(
LogLevel.Debug,
1,
new EventId(1, nameof(NotMostEffectiveFilter)),
"Skipping the execution of current filter as its not the most effective filter implementing the policy {FilterPolicy}.");
_beforeExecutingMethodOnFilter = LoggerMessage.Define<string, string, string>(
LogLevel.Trace,
1,
new EventId(1, nameof(BeforeExecutingMethodOnFilter)),
"{FilterType}: Before executing {Method} on filter {Filter}.");
_afterExecutingMethodOnFilter = LoggerMessage.Define<string, string, string>(
LogLevel.Trace,
2,
new EventId(2, nameof(AfterExecutingMethodOnFilter)),
"{FilterType}: After executing {Method} on filter {Filter}.");
_unsupportedAreaPath = LoggerMessage.Define<string>(
LogLevel.Warning,
1,
new EventId(1, nameof(UnsupportedAreaPath)),
"The page at '{FilePath}' is located under the area root directory '/Areas/' but does not follow the path format '/Areas/AreaName/Pages/Directory/FileName.cshtml");
}

View File

@ -14,7 +14,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
{
_distributedFormatterDeserializedFailed = LoggerMessage.Define<string>(
LogLevel.Error,
1,
new EventId(1, nameof(DistributedFormatterDeserializationException)),
"Couldn't deserialize cached value for key {Key}.");
}

View File

@ -42,83 +42,83 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures
{
_viewComponentExecuting = LoggerMessage.Define<string, string[]>(
LogLevel.Debug,
1,
new EventId(1, nameof(ViewComponentExecuting)),
"Executing view component {ViewComponentName} with arguments ({Arguments}).");
_viewComponentExecuted = LoggerMessage.Define<string, double, string>(
LogLevel.Debug,
2,
new EventId(2, nameof(ViewComponentExecuted)),
"Executed view component {ViewComponentName} in {ElapsedMilliseconds}ms and returned " +
"{ViewComponentResult}");
_partialViewResultExecuting = LoggerMessage.Define<string>(
LogLevel.Information,
1,
new EventId(1, nameof(PartialViewResultExecuting)),
"Executing PartialViewResult, running view {PartialViewName}.");
_partialViewFound = LoggerMessage.Define<string, double>(
LogLevel.Debug,
2,
new EventId(2, nameof(PartialViewFound)),
"The partial view path '{PartialViewFilePath}' was found in {ElapsedMilliseconds}ms.");
_partialViewNotFound = LoggerMessage.Define<string, IEnumerable<string>>(
LogLevel.Error,
3,
new EventId(3, nameof(PartialViewNotFound)),
"The partial view '{PartialViewName}' was not found. Searched locations: {SearchedViewLocations}");
_partialViewResultExecuted = LoggerMessage.Define<string, double>(
LogLevel.Information,
4,
new EventId(4, nameof(PartialViewResultExecuted)),
"Executed PartialViewResult - view {PartialViewName} executed in {ElapsedMilliseconds}ms.");
_antiforgeryTokenInvalid = LoggerMessage.Define<string>(
LogLevel.Information,
1,
new EventId(1, nameof(AntiforgeryTokenInvalid)),
"Antiforgery token validation failed. {Message}");
_viewComponentResultExecuting = LoggerMessage.Define<string>(
LogLevel.Information,
1,
new EventId(1, nameof(ViewComponentResultExecuting)),
"Executing ViewComponentResult, running {ViewComponentName}.");
_viewResultExecuting = LoggerMessage.Define<string>(
LogLevel.Information,
1,
new EventId(1, nameof(ViewResultExecuting)),
"Executing ViewResult, running view {ViewName}.");
_viewFound = LoggerMessage.Define<string, double>(
LogLevel.Debug,
2,
new EventId(2, nameof(ViewFound)),
"The view path '{ViewFilePath}' was found in {ElapsedMilliseconds}ms.");
_viewNotFound = LoggerMessage.Define<string, IEnumerable<string>>(
LogLevel.Error,
3,
new EventId(3, nameof(ViewNotFound)),
"The view '{ViewName}' was not found. Searched locations: {SearchedViewLocations}");
_viewResultExecuted = LoggerMessage.Define<string, double>(
LogLevel.Information,
4,
new EventId(4, nameof(ViewResultExecuted)),
"Executed ViewResult - view {ViewName} executed in {ElapsedMilliseconds}ms.");
_tempDataCookieNotFound = LoggerMessage.Define<string>(
LogLevel.Debug,
1,
new EventId(1, nameof(TempDataCookieNotFound)),
"The temp data cookie {CookieName} was not found.");
_tempDataCookieLoadSuccess = LoggerMessage.Define<string>(
LogLevel.Debug,
2,
new EventId(2, nameof(TempDataCookieLoadSuccess)),
"The temp data cookie {CookieName} was used to successfully load temp data.");
_tempDataCookieLoadFailure = LoggerMessage.Define<string>(
LogLevel.Warning,
3,
new EventId(3, nameof(TempDataCookieLoadFailure)),
"The temp data cookie {CookieName} could not be loaded.");
_notMostEffectiveFilter = LoggerMessage.Define<Type>(
LogLevel.Trace,
1,
new EventId(1, nameof(NotMostEffectiveFilter)),
"Skipping the execution of current filter as its not the most effective filter implementing the policy {FilterPolicy}.");
}