WallShell
An easy-to-use, highly portable, CLI using C99.
|
WallShell, by default, provides a very simple implementation of a logger.
Every logger function requires a logtype
. This is defined in the following enum:
There are two main logging functions:
This function acts like a normal printf
function. It takes the same type of printf
format string, the same args, etc.
This function acts the same as vprintf
.
Both logging functions print a newline character after your format string.
It's important to note that the output stream for these is not necessarily stdout
, it's whatever the current output stream is set to. If you never call ws_setStream(WS_OUTPUT, <stream>)
, it defaults to stdout, otherwise, it will print to whatever WS_OUTPUT
is set to.
If you so desire, you can change logger colors:
It changes the colors for the corresponding logtype
. It will remain this way until it is changed to something else.
These are the default colors for each log type:
If you have threaded support enabled, logging functions will print out the thread ID of the calling thread. You can disable this by calling ws_doPrintThreadID(false)
.
You can also add names to the threads. Most thread IDs are simply their handles (so usually a random int). You can add a name for the calling thread by doing ws_setThreadName("name")
, and remove a thread name by doing ws_removeThreadName(name)
.
Removing a thread name can be done from any thread, setting a thread name must be done from the thread you are naming. Setting a thread name does use memory, it is advised to remove it whenever a thread closes.