Closed goatshriek closed 1 year ago
Hi, I want to do this task, but I'm not sure if I understand it correctly.
There is already created function stumpless_get_facility_enum( const char *facility_string )
.
What is difference between this expected to do stumpless_facility_from_string
and stumpless_get_facility_enum( const char *facility_string )
?
Can you provide an usage example for it?
You're absolutely correct, I apologize for that. I had forgotten this was already done and missed the function when I did a quick check before making the issue.
I've updated this one to refer to the next thing that needs to be done with this function - please give the revised description a look and see if it's still something that interests you.
I think description is clear, but now I can see 2 things from the documentation logger :
auth or security security/authorization messages\n\
Please assign me to this task, I want to do it.
For kern
you do not need to do anything special; you should return STUMPLESS_FACILITY_KERN
. This special behavior will be up to the CLI tool to handle, but the library should allow any facility as it doesn't know what is using it.
security
can be treated as identical to auth
for this function, returning STUMPLESS_FACILITY_AUTH
.
The Stumpless Rust crate and CLI tool creates targets and entries to do whatever logging needed. In order to provide CLI support, many of these tasks need to use the strings provided in the command to set up stumpless structures. One of these is the prival used for the severity and facility values of the logged entry. To support this, the existing
stumpless_get_facility_enum
function needs to be enhanced to support the same strings that standard logging tools do.Currently the facility enum from string function only supports strings that exactly match the name of the symbol for a facility level, such as "STUMPLESS_FACILITY_AUTH". It needs to be updated to support the following strings, as well as not being case sensitive.
General Approach
There are a few details left out of the following approach, for you to fill in as you encounter them. If you find you need help, please ask here or on the project gitter and someone can help you get past the stumbling block.
First, review the existing implementation of
stumpless_get_facility_enum
insrc/facility.c
. Once you understand how the current implementation works, start adding the new functionality. Note that the list of new strings to accept mostly matches the end of the current symbol names without theSTUMPLESS_FACILITY_
prefix - you can likely use this fact to simplify your implementation.Add tests for your new functionality in the existing test module
test/function/facility.cpp
, as separate test cases from the existing ones for this function. Be sure that you test for upper and lower case versions of the strings (both should be accepted), invalid strings, empty strings, and NULL strings at a minimum.EDIT: this issue was originally duplicative of #237 and has been updated to specify the next phase of intended functionality.