A line of text, presumably with <tags>.
The base LogLevel to fall back to on </> tags.
The passed line but with any <tags> replaced with ANSI colour sequences. The original string is passed back if there was nothing to replace.
import kameloso.common : logger; import std.conv : text, to; { immutable line = "This is a <l>log</> line."; immutable replaced = line.expandTags(LogLevel.off); immutable expected = text("This is a ", logger.logtint, "log", logger.offtint, " line."); assert((replaced == expected), replaced); }
String-replaces <tags> in a string with the results from calls to KamelosoLogger *tint methods. Also works with dstrings and wstrings. Overload that does not take a strip Flag.