-
Notifications
You must be signed in to change notification settings - Fork 51
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
modules/kvs: Log to flux not stderr #1190
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1190 +/- ##
==========================================
+ Coverage 77.82% 77.83% +0.01%
==========================================
Files 158 158
Lines 29288 29295 +7
==========================================
+ Hits 22794 22803 +9
+ Misses 6494 6492 -2
|
codecov diff is unsurprisingly bad, as all changes are "impossible" to hit error cases |
Yeah, I think we could ignore the coverage here. I wonder if it would be a good idea to submit a mini-PR for the logging code before this one containing a change like this, so we can avoid the test for diff --git a/src/common/libflux/flog.c b/src/common/libflux/flog.c
index 8eae5cb..9944464 100644
--- a/src/common/libflux/flog.c
+++ b/src/common/libflux/flog.c
@@ -134,7 +134,7 @@ done:
int flux_vlog (flux_t *h, int level, const char *fmt, va_list ap)
{
- logctx_t *ctx = getctx (h);
+ logctx_t *ctx;
int saved_errno = errno;
uint32_t rank;
int len;
@@ -143,7 +143,11 @@ int flux_vlog (flux_t *h, int level, const char *fmt, va_list ap)
struct stdlog_header hdr;
int rpc_flags = FLUX_RPC_NORESPONSE;
- if (!ctx) {
+ if (!h) {
+ return vfprintf (stderr, fmt, ap);
+ }
+
+ if (!(ctx = getctx (h))) {
errno = ENOMEM;
goto fatal;
} I guess probably there'd be a bit more to it - man page update, a test, maybe include |
@garlick I hadn't thought about that, but I think it's a good idea. I'll take a look at that first. |
re-pushed w/ updates given #1192 |
src/modules/kvs/commit.h
Outdated
@@ -96,8 +97,10 @@ void commit_cleanup_dirty_cache_entry (commit_t *c, struct cache_entry *hp); | |||
* commit_mgr_t API | |||
*/ | |||
|
|||
/* flux_t is optional, if NULL no logging will occur */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might want to update this comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops! thanks
Replace lingering log calls that log to stderr with calls that log to flux logging facility. Requires passing optional flux_t handle to internal lookup and commit APIs. Remove lingering unnecessary includes of log.h throughout. Fixes flux-framework#1165
Thanks @chu11, this looks good. |
Replace lingering log calls that log to stderr with calls that
log to flux logging facility. Requires passing optional flux_t
handle to internal lookup and commit APIs.
Remove lingering unnecessary includes of log.h throughout.
Fixes #1165