Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
9b8f33df
Commit
9b8f33df
authored
Oct 06, 2016
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '1.4.x' into 1.5.x
parents
0fe0ad4c
20a2db79
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
16 deletions
+44
-16
ConditionEvaluationReportMessage.java
...toconfigure/logging/ConditionEvaluationReportMessage.java
+44
-16
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/logging/ConditionEvaluationReportMessage.java
View file @
9b8f33df
...
...
@@ -55,7 +55,7 @@ public class ConditionEvaluationReportMessage {
report
.
getConditionAndOutcomesBySource
());
for
(
Map
.
Entry
<
String
,
ConditionAndOutcomes
>
entry
:
shortOutcomes
.
entrySet
())
{
if
(
entry
.
getValue
().
isFullMatch
())
{
addLogMessage
(
message
,
entry
.
getKey
(),
entry
.
getValue
());
add
Match
LogMessage
(
message
,
entry
.
getKey
(),
entry
.
getValue
());
}
}
message
.
append
(
String
.
format
(
"%n%n"
));
...
...
@@ -63,7 +63,7 @@ public class ConditionEvaluationReportMessage {
message
.
append
(
String
.
format
(
"-----------------%n"
));
for
(
Map
.
Entry
<
String
,
ConditionAndOutcomes
>
entry
:
shortOutcomes
.
entrySet
())
{
if
(!
entry
.
getValue
().
isFullMatch
())
{
addLogMessage
(
message
,
entry
.
getKey
(),
entry
.
getValue
());
add
NonMatch
LogMessage
(
message
,
entry
.
getKey
(),
entry
.
getValue
());
}
}
message
.
append
(
String
.
format
(
"%n%n"
));
...
...
@@ -109,28 +109,56 @@ public class ConditionEvaluationReportMessage {
return
result
;
}
private
void
addLogMessage
(
StringBuilder
message
,
String
source
,
private
void
addMatchLogMessage
(
StringBuilder
message
,
String
source
,
ConditionAndOutcomes
matches
)
{
message
.
append
(
String
.
format
(
"%n %s matched:%n"
,
source
));
for
(
ConditionAndOutcome
match
:
matches
)
{
logConditionAndOutcome
(
message
,
" "
,
match
);
}
}
private
void
addNonMatchLogMessage
(
StringBuilder
message
,
String
source
,
ConditionAndOutcomes
conditionAndOutcomes
)
{
message
.
append
(
String
.
format
(
"%n %s"
,
source
));
message
.
append
(
conditionAndOutcomes
.
isFullMatch
()
?
" matched"
:
" did not match"
)
.
append
(
String
.
format
(
"%n"
)
);
message
.
append
(
String
.
format
(
"%n %s
:%n
"
,
source
));
List
<
ConditionAndOutcome
>
matches
=
new
ArrayList
<
ConditionAndOutcome
>();
List
<
ConditionAndOutcome
>
nonMatches
=
new
ArrayList
<
ConditionAndOutcome
>(
);
for
(
ConditionAndOutcome
conditionAndOutcome
:
conditionAndOutcomes
)
{
message
.
append
(
" - "
);
String
outcomeMessage
=
conditionAndOutcome
.
getOutcome
().
getMessage
();
if
(
StringUtils
.
hasLength
(
outcomeMessage
))
{
message
.
append
(
outcomeMessage
);
if
(
conditionAndOutcome
.
getOutcome
().
isMatch
())
{
matches
.
add
(
conditionAndOutcome
);
}
else
{
message
.
append
(
conditionAndOutcome
.
getOutcome
().
isMatch
()
?
"matched"
:
"did not match"
);
nonMatches
.
add
(
conditionAndOutcome
);
}
}
message
.
append
(
String
.
format
(
" Did not match:%n"
));
for
(
ConditionAndOutcome
nonMatch
:
nonMatches
)
{
logConditionAndOutcome
(
message
,
" "
,
nonMatch
);
}
if
(!
matches
.
isEmpty
())
{
message
.
append
(
String
.
format
(
" Matched:%n"
));
for
(
ConditionAndOutcome
match
:
matches
)
{
logConditionAndOutcome
(
message
,
" "
,
match
);
}
message
.
append
(
" ("
);
message
.
append
(
ClassUtils
.
getShortName
(
conditionAndOutcome
.
getCondition
().
getClass
()));
message
.
append
(
String
.
format
(
")%n"
));
}
}
private
void
logConditionAndOutcome
(
StringBuilder
message
,
String
indent
,
ConditionAndOutcome
conditionAndOutcome
)
{
message
.
append
(
String
.
format
(
"%s- "
,
indent
));
String
outcomeMessage
=
conditionAndOutcome
.
getOutcome
().
getMessage
();
if
(
StringUtils
.
hasLength
(
outcomeMessage
))
{
message
.
append
(
outcomeMessage
);
}
else
{
message
.
append
(
conditionAndOutcome
.
getOutcome
().
isMatch
()
?
"matched"
:
"did not match"
);
}
message
.
append
(
" ("
);
message
.
append
(
ClassUtils
.
getShortName
(
conditionAndOutcome
.
getCondition
().
getClass
()));
message
.
append
(
String
.
format
(
")%n"
));
}
@Override
public
String
toString
()
{
return
this
.
message
.
toString
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment