-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
colored-terminal-output #290
Conversation
cmake and ctest are working fine thats why I didnt see this errors. After further inspection, including
stream_target is needed from private/stream.h |
Codecov ReportBase: 92.88% // Head: 92.60% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## latest #290 +/- ##
==========================================
- Coverage 92.88% 92.60% -0.28%
==========================================
Files 39 39
Lines 3358 3423 +65
Branches 422 440 +18
==========================================
+ Hits 3119 3170 +51
- Misses 160 169 +9
- Partials 79 84 +5
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
It looks like you are getting there! Changing the public-facing signature to use the generic target structure was the correct thing to do. Looks like some memory leaks are present, causing valgrind to fail: make sure you delete the severity array in the target destructor. Alternatively, since the severity array is of fixed size, consider allocating it in the struct itself instead of with dynamic memory calls. Let me know once tests are added, and I will do a full review. |
979ed06
to
08ba828
Compare
_Atomic error is caused by including thread_safety header in cpp test files . But, |
TEST( SetSeverityColor, StdoutBasicArgs ){
struct stumpless_target *target;
const struct stumpless_error *error;
struct stumpless_entry *basic_entry;
struct stumpless_entry *result;
int log_result;
std::FILE* ofs = tmpfile();
target = stumpless_open_stream_target( "stdout-test", ofs );
stumpless_set_severity_color( target, STUMPLESS_SEVERITY_EMERG, "\033[31m" );
basic_entry = stumpless_new_entry( STUMPLESS_FACILITY_USER,
STUMPLESS_SEVERITY_EMERG,
"stumpless-unit-test",
"basic-entry",
"basic test message" );
log_result = stumpless_add_entry( target, basic_entry );
char *written_msg = NULL;
char *reset_code = NULL;
size_t line1,line2;
fseek(ofs, 0, SEEK_SET);
getline( &written_msg, &line1, ofs);
getline( &reset_code, &line2, ofs);
written_msg[5] = '\0';
EXPECT_STREQ( written_msg, "\033[31m" );
EXPECT_STREQ( reset_code, "\033[0m" );
} Is this approach ok ? |
6d06ca9
to
ce1cd41
Compare
ce1cd41
to
1679a33
Compare
Yes, that approach to testing looks fine! I took a look at your changes, and it looks like things are closing in on finished. You appear to have some heap corruption issues, which may be stemming from the fact that new stream targets do not have their Keep it up! |
Checking in to see if you intend to continue work on this, per the contribution guidelines. |
Closed as stale. |
add colored console output as mentioned in #103