virtual class journal
virtual Provides logging functions to store transactions to a log or a CSV file.
| journal | virtual Provides logging functions to store transactions to a log or a CSV file. |
| Properties | |
| log_fd | The file descriptor for the log. |
| csv_fd | The file descriptor for the CSV file. |
| Functions | |
| log | static Stores a transaction to the file specified by the log_fd using the format shown in the Example below. |
| csv | static Stores a transaction to the file specified by the csv_fd using the CSV (comma separated value) format shown in the Example below. |
static function void log( string desc, string from_unit = "journal", string to_unit = from_unit )
static Stores a transaction to the file specified by the log_fd using the format shown in the Example below. It is user’s responsibility to open the log file before calling this function.
| desc | The description of a transaction. |
| from_unit | optional The name of the unit the transaction comes from. The default name is “journal”. |
| to_unit | optional The name of the unit the transaction goes to. The default name is the value of from_unit. |
journal::log_fd = $fopen( "journal.log", "w" ); journal::log( "request", "master", "slave" ); #100; journal::log( "response", "slave", "master" ); /* journal.log */ // master->slave: @0 request // slave->master: @100 response
static function void csv( string desc, string from_unit = "journal", string to_unit = from_unit )
static Stores a transaction to the file specified by the csv_fd using the CSV (comma separated value) format shown in the Example below. It is user’s responsibility to open the CSV file before calling this function.
| desc | The description of a transaction. |
| from_unit | optional The name of the unit the transaction comes from. The default name is “journal”. |
| to_unit | optional The name of the unit the transaction goes to. The default name is the value of from_unit. |
journal::csv_fd = $fopen( "journal.csv", "w" ); journal::csv( "request", "master", "slave" ); #100; journal::csv( "response", "slave", "master" ); /* journal.csv */ // "master","slave","@0 request" // "slave","master","@100 response"
virtual Provides logging functions to store transactions to a log or a CSV file.
virtual class journal
The file descriptor for the log.
static integer log_fd
The file descriptor for the CSV file.
static integer csv_fd
static Stores a transaction to the file specified by the log_fd using the format shown in the Example below.
static function void log( string desc, string from_unit = "journal", string to_unit = from_unit )
static Stores a transaction to the file specified by the csv_fd using the CSV (comma separated value) format shown in the Example below.
static function void csv( string desc, string from_unit = "journal", string to_unit = from_unit )