Log.beginBlock
From Spheriki
Begins a log block, signifying a group of log messages that belong together.
Contents |
Usage
- Log Sphere Log object. The log in which to start the block.
- name String. The title of the block.
Examples
var l = OpenLog("ach.txt");
l.write("This is outside the block.");
l.beginBlock("Strawberries");
l.write("Inside the block!");
l.write("Doing nothing in particular.");
l.endBlock();
l.write("Outside the block again.");
This example is rather self-explanatory if read through. Opening up the file 'logs/ach.txt' will show that the messages inside the block are indented, and headed with the title "Strawberries".
Notes
- Blocks are useful for debugging to group messages together. One particular technique is to open a block at the start of a function, and close it at the end using Log.endBlock().
- For best readability, close blocks using Log.endBlock().
See also
- Sphere Log object
- Log.endBlock()
- Log.write()
- OpenLog()