goatshriek / stumpless

a C logging library built for performance and features
https://goatshriek.github.io/stumpless
Apache License 2.0
446 stars 336 forks source link

priority to string function #450

Open goatshriek opened 1 month ago

goatshriek commented 1 month ago

A function exists to get the string representation of a prival, stumpless_get_prival_string, which returns a string version of the two enumerations used to create the prival. However, this is longer and more verbose than need be, and a more succinct representation would follow the priority string convention used by tools like logger, for example local3.info. You will write a second function that generates this shorter form string for a prival.

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, read this section of the development documentation on adding new functions. Once you understand how this process works, start defining the new function.

Review the existing implementation of stumpless_get_prival_string in src/prival.c. Once you understand how the current implementation works, start adding the new functionality to the same file and the associated header, in a function named stumpless_get_priority_string.

Note that stumpless_prival_from_string accepts strings in the same format of facility.severity. You can reference this implementation for ideas on how to implement the new function.

Add tests for your new functionality in the existing test module test/function/prival.cpp, based on the tests already there.

KlowdfurrRad commented 3 weeks ago

Hi, I would like to work on this. This would be my first contribution. My background is mostly C++ and some C.

goatshriek commented 3 weeks ago

There is already PR #457 open to resolve this issue. Are there any other issues in the repository that you are interested in? There may be some more to string function implementation issues added in the next week or so as well.

KlowdfurrRad commented 3 weeks ago

Oh okay. Can I work on param into string function in that case? This one seems to not be assigned. But if someone is working on it I am interested in trying entry to string as well.

goatshriek commented 3 weeks ago

Either of those should be fine! Whichever you would like can be assigned, just drop a comment on the issue you'd like (not here).