mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-17 20:50:44 +00:00
added non-ascii to ascii library, timer pretty print
This commit is contained in:
@ -65,7 +65,11 @@
|
||||
<artifactId>aws-java-sdk-secretsmanager</artifactId>
|
||||
<version>1.12.385</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ibm.icu</groupId>
|
||||
<artifactId>icu4j</artifactId>
|
||||
<version>77.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
|
@ -26,6 +26,7 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import com.ibm.icu.text.Transliterator;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
@ -462,6 +463,17 @@ public class StringUtils
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
public static String replaceNonAsciiCharacters(String s)
|
||||
{
|
||||
Transliterator transliterator = Transliterator.getInstance("Any-Latin; Latin-ASCII");
|
||||
return (transliterator.transliterate(s));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
**
|
||||
***************************************************************************/
|
||||
|
@ -22,6 +22,7 @@
|
||||
package com.kingsrook.qqq.backend.core.utils;
|
||||
|
||||
|
||||
import java.time.Duration;
|
||||
import com.kingsrook.qqq.backend.core.logging.QLogger;
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
@ -79,9 +80,36 @@ public class Timer
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void mark(String message)
|
||||
{
|
||||
mark(message, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
public void mark(String message, boolean prettyPrint)
|
||||
{
|
||||
long now = System.currentTimeMillis();
|
||||
LOG.log(level, String.format("%s: Last [%5d] Total [%5d] %s", name, (now - last), (now - start), message));
|
||||
|
||||
if(!prettyPrint)
|
||||
{
|
||||
LOG.log(level, String.format("%s: Last [%5d] Total [%5d] %s", name, (now - last), (now - start), message));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Duration lastDuration = Duration.ofMillis(now - last);
|
||||
Duration totalDuration = Duration.ofMillis(now - start);
|
||||
|
||||
LOG.log(level, String.format(
|
||||
"%s: Last [%d hours, %d minutes, %d seconds, %d milliseconds] Total [%d hours, %d minutes, %d seconds, %d milliseconds] %s",
|
||||
name, lastDuration.toHours(), lastDuration.toMinutesPart(), lastDuration.toSecondsPart(), lastDuration.toMillisPart(),
|
||||
totalDuration.toHours(), totalDuration.toMinutesPart(), totalDuration.toSecondsPart(), totalDuration.toMillisPart(),
|
||||
message));
|
||||
}
|
||||
|
||||
last = now;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user