public class MacroExpansionStepsLogger extends java.lang.Object
NO_OP
Logger
which does nothing).
This needs to be in the production code (rather than test code) because it is used at least one debug service in production instances (PreprocessorExpansionDebugService).
Modifier and Type | Field and Description |
---|---|
static MacroExpansionStepsLogger |
NO_OP
The default
MacroExpansionStepsLogger , which does nothing and does
not cost runtime. |
Constructor and Description |
---|
MacroExpansionStepsLogger(java.io.PrintStream outputPrintStream)
Creates a
MacroExpansionStepsLogger that writes to a PrintStream with
UTF-8 encoding. |
MacroExpansionStepsLogger(java.io.Writer outputPrintWriter)
Creates a
MacroExpansionStepsLogger that writes log messages to the
given Writer. |
Modifier and Type | Method and Description |
---|---|
void |
decrementNestingDepth()
Decrement the tab-nesting depth before future messages.
|
void |
incrementNestingDepth()
Increment the tab-nesting depth before future messages.
|
void |
logStatusMessage(java.util.List<IToken> currentTokens1,
java.util.List<IToken> currentTokens2,
java.lang.String logMessage,
eu.cqse.check.framework.preprocessor.c.new_c_preprocessor.NewMacroInvocationPreprocessor.TokenDisablingContext tokenDisablingContext)
Delegates to
logStatusMessage(List, String, NewMacroInvocationPreprocessor.TokenDisablingContext)
but concatenates the two given lists first. |
void |
logStatusMessage(java.util.List<IToken> macroContent,
java.lang.String logMessage,
eu.cqse.check.framework.preprocessor.c.new_c_preprocessor.NewMacroInvocationPreprocessor.TokenDisablingContext tokenDisablingContext)
Logs the given message with printing the current tokens (in contrast to
#logStatusMessage(String, String) ). |
void |
logStatusMessage(java.util.List<IToken> macroContent,
java.util.function.Supplier<java.lang.String> logMessage,
eu.cqse.check.framework.preprocessor.c.new_c_preprocessor.NewMacroInvocationPreprocessor.TokenDisablingContext tokenDisablingContext)
Delegates to
logStatusMessage(List, String, NewMacroInvocationPreprocessor.TokenDisablingContext)
using the given Supplier for the log message. |
void |
logStatusMessage(java.lang.String messageTag,
java.util.function.Supplier<java.lang.String> messageContent)
Logs the given message without printing the current tokens (in contrast to
logStatusMessage(List, String, NewMacroInvocationPreprocessor.TokenDisablingContext) ). |
public static final MacroExpansionStepsLogger NO_OP
MacroExpansionStepsLogger
, which does nothing and does
not cost runtime.public MacroExpansionStepsLogger(java.io.PrintStream outputPrintStream)
MacroExpansionStepsLogger
that writes to a PrintStream with
UTF-8 encoding. Call with System.out
argument for debugging.public MacroExpansionStepsLogger(java.io.Writer outputPrintWriter)
MacroExpansionStepsLogger
that writes log messages to the
given Writer.public void incrementNestingDepth()
public void decrementNestingDepth()
public void logStatusMessage(java.util.List<IToken> macroContent, java.lang.String logMessage, eu.cqse.check.framework.preprocessor.c.new_c_preprocessor.NewMacroInvocationPreprocessor.TokenDisablingContext tokenDisablingContext)
#logStatusMessage(String, String)
).
Log message will look like this:
INDENTATION_SPACES logMessage MORE_SPACES tokens
The number of spaces in INDENTATION_SPACES corresponds to the current indentation level. The number of spaces in MORE_SPACES is computed such that tokens of all messages on the same indentation level start in the same column (improves readability) unless logMessage is too long.
Tokens that are "painted blue"/flagged as no_expand in the given tokenDisablingContext are marked with a °.
public void logStatusMessage(java.util.List<IToken> macroContent, java.util.function.Supplier<java.lang.String> logMessage, eu.cqse.check.framework.preprocessor.c.new_c_preprocessor.NewMacroInvocationPreprocessor.TokenDisablingContext tokenDisablingContext)
logStatusMessage(List, String, NewMacroInvocationPreprocessor.TokenDisablingContext)
using the given Supplier
for the log message. Since this log call
does nothing in production (when using NO_OP
), using the
Supplier
will be cheaper than building an unnecessary String.public void logStatusMessage(java.util.List<IToken> currentTokens1, java.util.List<IToken> currentTokens2, java.lang.String logMessage, eu.cqse.check.framework.preprocessor.c.new_c_preprocessor.NewMacroInvocationPreprocessor.TokenDisablingContext tokenDisablingContext)
logStatusMessage(List, String, NewMacroInvocationPreprocessor.TokenDisablingContext)
but concatenates the two given lists first. Using this method (with a two
lists) will be cheaper in production (using NO_OP
since
concatenating the token lists might be expensive and the list would be
dropped anyway (if using NO_OP
).public void logStatusMessage(java.lang.String messageTag, java.util.function.Supplier<java.lang.String> messageContent)
logStatusMessage(List, String, NewMacroInvocationPreprocessor.TokenDisablingContext)
).
Log message will look like this:
INDENTATION_SPACES messageTag MORE_SPACES messageContent
The number of spaces in INDENTATION_SPACES corresponds to the current indentation level. The number of spaces in MORE_SPACES is computed such that messageContent of all messages on the same indentation level start in the same column (improves readability) unless messageTag is too long.