public final class SimpleLog
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
boolean |
always_traceback
Always provide a backtrace (traceback) when calling
log() . |
boolean |
enabled
If false, do no output.
|
java.lang.String |
INDENT_STR_ONE_LEVEL
Indentation string for one level of indentation.
|
boolean |
line_oriented
True if every log call is made with a complete line of text.
|
java.util.ArrayDeque<java.lang.Long> |
start_times |
Constructor and Description |
---|
SimpleLog() |
SimpleLog(boolean enabled) |
SimpleLog(boolean enabled,
boolean always_traceback)
Create a new SimpleLog object.
|
SimpleLog(java.lang.String filename) |
SimpleLog(java.lang.String filename,
boolean enabled)
Create a new SimpleLog object.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears indent and start times and then pushes one start time.
|
void |
clear(java.lang.String format,
java.lang.Object... args)
Calls
clear() and then logs the specified message |
boolean |
enabled() |
void |
exdent_time(java.lang.String format,
java.lang.Object... args)
Prints the time (showing the time for the nested timer) and then calls
exdent() . |
void |
exdent()
Exdents: reduces indentation and pops a start time.
|
void |
indent()
Indents by one level and pushes a corresponding start time.
|
void |
indent(java.lang.String format,
java.lang.Object... args)
Prints to the log, then indents.
|
void |
log_tb(java.lang.String format,
java.lang.Object... args)
Log a message, and provide a backtrace (traceback, or tb).
|
void |
log_time(java.lang.String format,
java.lang.Object... args)
Writes the specified message and the elapsed time since the last call to start_time().
|
void |
log(java.lang.String format,
java.lang.Object... args)
Log a message.
|
void |
pop_start_time()
Pops a start time from the stack.
|
void |
push_start_time()
Push a new start time onto the stack.
|
void |
reset_start_time()
This overwrites the current start time; it does not push a new one!!
|
void |
tb()
Print a backtrace (traceback, or tb) to the log.
|
public boolean enabled
public boolean always_traceback
log()
.public final java.lang.String INDENT_STR_ONE_LEVEL
public boolean line_oriented
public java.util.ArrayDeque<java.lang.Long> start_times
public SimpleLog(boolean enabled, boolean always_traceback)
enabled
- whether the logger starts out enabledalways_traceback
- whether to always provide a backtrace (traceback) when calling log()
public SimpleLog(boolean enabled)
public SimpleLog()
public SimpleLog(java.lang.String filename, boolean enabled)
filename
- file name, or use "-" or null for standard outputenabled
- whether the logger starts out enabledpublic SimpleLog(java.lang.String filename)
filename
- file name, or use "-" or null for standard outputpublic boolean enabled()
public void log(java.lang.String format, java.lang.Object... args)
format
- format string for messageargs
- values to be substituted into formatpublic void log_tb(java.lang.String format, java.lang.Object... args)
format
- format string for messageargs
- values to be substituted into formatpublic void tb()
public void indent()
public void indent(java.lang.String format, java.lang.Object... args)
format
- format string for messageargs
- values to be substituted into formatindent()
public void clear()
public void clear(java.lang.String format, java.lang.Object... args)
clear()
and then logs the specified messageformat
- format string for messageargs
- values to be substituted into formatpublic void exdent()
public void exdent_time(java.lang.String format, java.lang.Object... args)
exdent()
.format
- format string for messageargs
- values to be substituted into formatpublic void reset_start_time()
public void push_start_time()
public void pop_start_time()
public void log_time(java.lang.String format, java.lang.Object... args)
format
- format string for messageargs
- values to be substituted into format