Fix padding of dates and times in log format
This commit is contained in:
parent
ef692a31d5
commit
e76b0e72ff
2 changed files with 8 additions and 10 deletions
|
@ -115,13 +115,11 @@ class Processor private constructor() {
|
||||||
if (
|
if (
|
||||||
(channelconf.sanitizeMessage ?: ChannelSettings.global.sanitizeMessage) != false
|
(channelconf.sanitizeMessage ?: ChannelSettings.global.sanitizeMessage) != false
|
||||||
&& (channelconf.permitFormatting ?: ChannelSettings.global.permitFormatting) != false
|
&& (channelconf.permitFormatting ?: ChannelSettings.global.permitFormatting) != false
|
||||||
)
|
) message = message.replace("<", "\\<")
|
||||||
message = message.replace("<", "\\<")
|
|
||||||
if (
|
if (
|
||||||
((channelconf.permitFormatting ?: ChannelSettings.global.permitFormatting) != false)
|
((channelconf.permitFormatting ?: ChannelSettings.global.permitFormatting) != false)
|
||||||
&& LoggerConfiguration.features.contains(Feature.FORMATTING)
|
&& LoggerConfiguration.features.contains(Feature.FORMATTING)
|
||||||
)
|
) format.addFeature(Feature.FORMATTING)
|
||||||
format.addFeature(Feature.FORMATTING)
|
|
||||||
|
|
||||||
// Set message
|
// Set message
|
||||||
format.message = message
|
format.message = message
|
||||||
|
|
|
@ -91,20 +91,20 @@ class SOSLSv2FormatBuilder(call: Call) : FormatBuilder(call) {
|
||||||
format.append("[")
|
format.append("[")
|
||||||
if (enabledFeatures.contains(Feature.DATE))
|
if (enabledFeatures.contains(Feature.DATE))
|
||||||
format
|
format
|
||||||
.append(datetime.dayOfMonth)
|
.append("%02d".format(datetime.dayOfMonth.toString()))
|
||||||
.append(".")
|
.append(".")
|
||||||
.append(datetime.monthNumber)
|
.append("%02d".format(datetime.monthNumber))
|
||||||
.append(".")
|
.append(".")
|
||||||
.append(datetime.year)
|
.append("%04d".format(datetime.year))
|
||||||
if (enabledFeatures.contains(Feature.DATE) && enabledFeatures.contains(Feature.TIME))
|
if (enabledFeatures.contains(Feature.DATE) && enabledFeatures.contains(Feature.TIME))
|
||||||
format.append(" ")
|
format.append(" ")
|
||||||
if (enabledFeatures.contains(Feature.TIME))
|
if (enabledFeatures.contains(Feature.TIME))
|
||||||
format
|
format
|
||||||
.append(datetime.hour)
|
.append("%02d".format(datetime.hour))
|
||||||
.append(":")
|
.append(":")
|
||||||
.append(datetime.minute)
|
.append("%02d".format(datetime.minute))
|
||||||
.append(":")
|
.append(":")
|
||||||
.append(datetime.second)
|
.append("%02d".format(datetime.second))
|
||||||
if (enabledFeatures.contains(Feature.DATE) || enabledFeatures.contains(Feature.TIME))
|
if (enabledFeatures.contains(Feature.DATE) || enabledFeatures.contains(Feature.TIME))
|
||||||
format.append("] ")
|
format.append("] ")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue