Scol standard library package
0.3.1
Common and usefull functions for all Scol applications
|
Functions | |
std_errAddType (err, num, str) | |
Add a new predefined error in a manager. More... | |
std_errClearTypes (err) | |
Reset all predefined error in a manager. More... | |
std_errClose (err) | |
Close a manager. If TMPFILE is enabled, the temporary file is closed and its content is lost. More... | |
std_errCopy (err, filename) | |
Open a new manager in copying the configuration of another one. More... | |
std_errGetConsole (err) | |
Returns if the Scol console is shown (for this manager) Only if this API manages the Scol console, if another code show or hide it, this return can be wrong. More... | |
std_errGetContent (err) | |
Returns the content of the log file (for a manager) This can be a hard file or a temporary file. More... | |
std_errGetEnabled (err) | |
Returns the current state of a manager. More... | |
std_errGetFilename (err) | |
Returns the path of the log file of a manager. More... | |
std_errGetFoo (err) | |
Returns if, for a manager, the message are displayed in the Scol console. More... | |
std_errGetIsTemp (err) | |
Returns if a temporary file is used (for a manager) More... | |
std_errGetLast (err) | |
Returns the last written message. More... | |
std_errGetMask (err) | |
Returns the current mask of a manager. More... | |
std_errGetObjDisabled () | |
Returns a list of all manager disabled. More... | |
std_errGetObjEnabled () | |
Returns a list of all manager enabled. More... | |
std_errGetPeriod (err) | |
Get the period. Period is unused, so this function is unused too ! More... | |
std_errGetTypeFromNumber (err, number) | |
Returns the string error message for a given number code error (for a manager) More... | |
std_errGetTypeFromString (err, str) | |
Returns the number code error from a given string error message (for a manager) More... | |
std_errGetTypes (err) | |
Returns the list of defined eror types for a manager. More... | |
std_errNumber (err, num, mask) | |
Send a predefined error to a manager. According the manager settings, the string can be written in the Scol console, in the application log file if the client set it, in the customized log file, ... More... | |
std_errNumberAndInConsole (err, csl, num, mask) | |
Same thing than std_errNumber. In addition, you can print the message error in a EasyConsole (see in lib/console directory) More... | |
std_errObjLast () | |
Returns the last created(opened) manager. More... | |
std_errObjNumbers () | |
Return the number of opened managers. More... | |
std_errOpen (mask) | |
Open a new manager By default, the manager is ENABLED, the console message and the console are disabled. Other parameters are at nil. More... | |
std_errOpenLog (err, filename) | |
Open a new log file The current date is written. More... | |
std_errOpenLogNow (err, name) | |
Open a new log file. The filename is the current date and time with a prefix : my_folder/the_prefix_2013_12_14-17_25_21.log The current date is written. The TMPFILE must be disabled. More... | |
std_errRemoveType (err, num) | |
Remove a predefined error in a manager. More... | |
std_errSaveTemp (err, filename) | |
A conivience function. Save the content of the temporary file in a hard file. More... | |
std_errSetConsole (err, state) | |
Set the state of the Scol console if another code show or hide it, the effect can be different. More... | |
std_errSetEnabled (err, state) | |
Set the current state of a manager. More... | |
std_errSetFoo (err, state) | |
Set if error message are displayed in the Scol console. More... | |
std_errSetIsTemp (err, isTmp, filename) | |
Set if a manager uses (or not) a temporary file. If the old and the new value are the same, no change is done. If the new value is 1 and the old value was 0, a new temporary file is created and the content of the old 'hard' file is copied in the new temporary file. The old 'hard' file is unchanged and no new message will be written. If the new file is 0 and the 'hard' file name is not nil, the file is created and the content of the old temporary file is copied. This last one is closed (and destroyed). All other configuration or an invalid argument will return a nil value. More... | |
std_errSetMask (err, mask) | |
Set the current mask of a manager. More... | |
std_errString (err, str, mask) | |
Send a new string message error to a manager. According the manager settings, the string can be written in the Scol console, in the application log file if the client set it, in the customized log file, ... More... | |
std_errStringAndInConsole (err, csl, str, mask) | |
Same thing than std_errString. In addition, you can print the string message error in a EasyConsole (see in lib/console directory) More... | |
std_errUndoMask (err) | |
Perform an 'undo' to the mask of a manager. More... | |
Package to load : lib/std/error.pkg
This API provides an high level method to easily include a customized error manager
You can :
It is NOT recommanded to use the internal STD_ERROR structure to any application. Use this API instead.
To use it with the Console library (lib/console), this API requires too the lib/console/console.pkg package.
std_errOpen | ( | mask | ) |
std_errOpenLog | ( | err | , |
filename | |||
) |
Open a new log file The current date is written.
Prototype: fun [STD_ERROR S] STD_ERROR
STD_ERROR | : a manager object |
S | : a filename for the log file if the TMPFILE is disabled if TMPFILE is enabled, this argument is ignored and could be nil. |
std_errOpenLogNow | ( | err | , |
name | |||
) |
Open a new log file. The filename is the current date and time with a prefix : my_folder/the_prefix_2013_12_14-17_25_21.log The current date is written. The TMPFILE must be disabled.
Prototype: fun [STD_ERROR S] STD_ERROR
STD_ERROR | : a manager object |
S | : a filename for the log file such as "my_folder/the_prefix" |
Note : if any, the current file is overwritten.
std_errClose | ( | err | ) |
Close a manager. If TMPFILE is enabled, the temporary file is closed and its content is lost.
Prototype: fun [STD_ERROR] I
STD_ERROR | : a manager object |
S | : a filename for the log file |
std_errCopy | ( | err | , |
filename | |||
) |
Open a new manager in copying the configuration of another one.
Prototype: fun [STD_ERROR S] STD_ERROR
STD_ERROR | : a manager object |
S | : a filename for the log file or nil if a temporary file is prefered |
Note : if any, the current file is overwritten.
std_errGetMask | ( | err | ) |
std_errSetMask | ( | err | , |
mask | |||
) |
std_errUndoMask | ( | err | ) |
std_errGetPeriod | ( | err | ) |
std_errGetFilename | ( | err | ) |
std_errGetEnabled | ( | err | ) |
std_errSetEnabled | ( | err | , |
state | |||
) |
std_errGetFoo | ( | err | ) |
std_errSetFoo | ( | err | , |
state | |||
) |
std_errGetLast | ( | err | ) |
std_errGetContent | ( | err | ) |
std_errSaveTemp | ( | err | , |
filename | |||
) |
std_errGetTypes | ( | err | ) |
std_errGetTypeFromNumber | ( | err | , |
number | |||
) |
std_errGetTypeFromString | ( | err | , |
str | |||
) |
Returns the number code error from a given string error message (for a manager)
Prototype: fun [STD_ERROR S] I
STD_ERRO] | : a manager object |
S | : a string error (case-insensitive) |
std_errAddType | ( | err | , |
num | , | ||
str | |||
) |
std_errClearTypes | ( | err | ) |
std_errRemoveType | ( | err | , |
num | |||
) |
std_errGetIsTemp | ( | err | ) |
std_errSetIsTemp | ( | err | , |
isTmp | , | ||
filename | |||
) |
Set if a manager uses (or not) a temporary file. If the old and the new value are the same, no change is done. If the new value is 1 and the old value was 0, a new temporary file is created and the content of the old 'hard' file is copied in the new temporary file. The old 'hard' file is unchanged and no new message will be written. If the new file is 0 and the 'hard' file name is not nil, the file is created and the content of the old temporary file is copied. This last one is closed (and destroyed). All other configuration or an invalid argument will return a nil value.
Prototype: fun [STD_ERROR I] STD_ERROR
STD_ERROR | : a manager object |
I | : 1 to use a temporary file, else 0 |
S | : a filename (should be nil if the temporay file will be used) |
std_errGetConsole | ( | err | ) |
std_errSetConsole | ( | err | , |
state | |||
) |
std_errString | ( | err | , |
str | , | ||
mask | |||
) |
Send a new string message error to a manager. According the manager settings, the string can be written in the Scol console, in the application log file if the client set it, in the customized log file, ...
Prototype: fun [STD_ERROR S I] I
STD_ERROR | : a manager object |
S | : the string message error |
I | : a mask for this message. It is tested with the mask of the manager to determine wether the message should be written. If the test is positive, the message is immediatly written. Thus, the logical 'mask_of_manager & mask_of_this_message' must be not null to write the message. |
std_errNumber | ( | err | , |
num | , | ||
mask | |||
) |
Send a predefined error to a manager. According the manager settings, the string can be written in the Scol console, in the application log file if the client set it, in the customized log file, ...
Prototype: fun [STD_ERROR I I] I
STD_ERROR | : a manager object |
I | : a predefined number error |
I | : a mask for this message. It is tested with the mask of the manager to determine wether the message should be written. If the test is positive, the message is immediatly written. Thus, the logical 'mask_of_manager & mask_of_this_message' must be at not null to write the message. |
std_errObjNumbers | ( | ) |
Return the number of opened managers.
Prototype: fun [ ] I
std_errObjLast | ( | ) |
std_errGetObjEnabled | ( | ) |
std_errGetObjDisabled | ( | ) |
std_errStringAndInConsole | ( | err | , |
csl | , | ||
str | , | ||
mask | |||
) |
Same thing than std_errString. In addition, you can print the string message error in a EasyConsole (see in lib/console directory)
Prototype: fun [STD_ERROR CONSOLE S I] I
STD_ERROR | : a manager object |
CONSOLE | : an EasyConsole already created. |
S | : the string message error |
I | : a mask for this message. It is tested with the mask of the manager to determine wether the message should be written. If the test is positive, the message is immediatly written. Thus, the logical 'mask_of_manager & mask_of_this_message' must be at not null to write the message. |
std_errNumberAndInConsole | ( | err | , |
csl | , | ||
num | , | ||
mask | |||
) |
Same thing than std_errNumber. In addition, you can print the message error in a EasyConsole (see in lib/console directory)
Prototype: fun [STD_ERROR CONSOLE I I] I
STD_ERROR | : a manager object |
CONSOLE | : an EasyConsole object |
I | : a predefined number error |
I | : a mask for this message. It is tested with the mask of the manager to determine wether the message should be written. If the test is positive, the message is immediatly written. Thus, the logical 'mask_of_manager & mask_of_this_message' must be at not null to write the message. |