Package io.karatelabs.output
Class Console
java.lang.Object
io.karatelabs.output.Console
Console output utilities with ANSI color support.
Also sends a copy (stripped of ANSI codes) to the karate.console logger at TRACE level.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final charstatic final charstatic final charstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringstatic StringbrightGreen(String text) static Stringstatic StringbrightYellow(String text) static Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic booleanstatic Stringstatic Stringline()static Stringline(int length) static Stringstatic voidstatic voidprintln()static voidstatic Stringstatic voidsetColorsEnabled(boolean enabled) static voidsetOutput(PrintStream output) Split a raw report log into ordered segments for the HTML report.static StringStrip ANSI escape codes and body sentinels — everything a plain-text consumer (JUnit XML, Cucumber JSON, JSONL, console mirror) should never see.static StringstripSentinels(String text) Remove body sentinels but keep ANSI color codes — for the console/SLF4J mirror, which wants the colored body shown but not the invisible markers.static Stringstatic String
-
Field Details
-
BODY_OPEN
public static final char BODY_OPEN- See Also:
-
BODY_LANG_END
public static final char BODY_LANG_END- See Also:
-
BODY_CLOSE
public static final char BODY_CLOSE- See Also:
-
RESET
- See Also:
-
BOLD
- See Also:
-
RED
- See Also:
-
GREEN
- See Also:
-
YELLOW
- See Also:
-
BLUE
- See Also:
-
MAGENTA
- See Also:
-
CYAN
- See Also:
-
WHITE
- See Also:
-
BRIGHT_RED
- See Also:
-
BRIGHT_GREEN
- See Also:
-
BRIGHT_YELLOW
- See Also:
-
BRIGHT_CYAN
- See Also:
-
DIM
- See Also:
-
GREY
- See Also:
-
-
Method Details
-
stripAnsi
Strip ANSI escape codes and body sentinels — everything a plain-text consumer (JUnit XML, Cucumber JSON, JSONL, console mirror) should never see. The HTML report is the only consumer that wants the sentinels; it reads the raw log viasplitLog(String)instead. -
stripSentinels
Remove body sentinels but keep ANSI color codes — for the console/SLF4J mirror, which wants the colored body shown but not the invisible markers. -
splitLog
Split a raw report log into ordered segments for the HTML report. Each segment is either{"text": <plain text>}or, for a body wrapped in sentinels,{"lang": <grammar>, "code": <body text>}. ANSI codes are stripped from every segment; only the sentinels select where a highlightable code block begins and ends. The request/header lines around a body stay as plain-text segments, so whitespace is preserved verbatim. -
setColorsEnabled
public static void setColorsEnabled(boolean enabled) -
isColorsEnabled
public static boolean isColorsEnabled() -
setOutput
-
color
-
bold
-
red
-
green
-
yellow
-
cyan
-
brightRed
-
brightGreen
-
brightYellow
-
grey
-
dim
-
pass
-
fail
-
warn
-
info
-
label
-
println
-
println
public static void println() -
print
-
line
-
line
-