Logging Functions - Pritesh-Mhatre/amibroker-library GitHub Wiki
It is an open source logging library for AmiBroker. It has following features:
- Print logs into files
- Specify the log directory (via chart parameters)
- Specify the file name (via chart parameters)
- You also will get to save file with different formats (csv, log, txt)
- Logs will be written in columns and you can specify column delimiters (helps to easily study the file in Excel)
- Automatically creates a separate logging file for each symbol (in scanner mode)
- Automatically creates a separate logging file for each day
- Finally there is also a provision to enable/disable logs
The default logging path is: C:\Program Files\AmiBroker\Logs.
Note: If the framework experiences any errors due to file permission issues, then it will stop logging.
These functions are available in logs-util.afl. To use these functions, add following line at the top of your afl:
#include <logs-util.afl>
Logs a TRACE category statement. Trace category is mostly used for detailed logging.
logTrace("Order placed successfully.");
// Logs the given text to the file with TRACE category.
Parameter | Type | Description |
---|---|---|
logText | string | The text that you want to log to the file |
Logs a DEBUG category statement. Debug is used for logging text that helps with debugging.
logDebug("Order placed successfully.");
// Logs the given text to the file with DEBUG category.
Parameter | Type | Description |
---|---|---|
logText | string | The text that you want to log to the file |
Logs a INFO category statement. Info category is mostly used for logging informative messages.
logInfo("Order placed successfully.");
// Logs the given text to the file with INFO category.
Parameter | Type | Description |
---|---|---|
logText | string | The text that you want to log to the file |
Logs an ERROR category statement. Error category is used for logging errors.
logError("Order placement failed.");
// Logs the given text to the file with ERROR category.
Parameter | Type | Description |
---|---|---|
logText | string | The text that you want to log to the file |