Skip to content
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

common: print basic lib info when new logging function is set #6021

Merged
merged 4 commits into from
Feb 23, 2024

Conversation

grom72
Copy link
Contributor

@grom72 grom72 commented Feb 22, 2024

This change is Reviewable

Signed-off-by: Tomasz Gromadzki <tomasz.gromadzki@intel.com>
@grom72 grom72 added sprint goal This pull request is part of the ongoing sprint no changelog Add to skip the changelog check on your pull request labels Feb 22, 2024
@grom72 grom72 added this to the 2.1.0 milestone Feb 22, 2024
@grom72 grom72 requested a review from janekmi February 22, 2024 16:55
Copy link

codecov bot commented Feb 22, 2024

Codecov Report

Attention: Patch coverage is 77.77778% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 70.05%. Comparing base (38d414e) to head (15de5c0).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6021      +/-   ##
==========================================
+ Coverage   70.03%   70.05%   +0.01%     
==========================================
  Files         133      133              
  Lines       19562    19564       +2     
  Branches     3263     3263              
==========================================
+ Hits        13701    13705       +4     
+ Misses       5861     5859       -2     

Copy link
Contributor

@janekmi janekmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 17 of 17 files at r1, all commit messages.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @grom72)


src/core/out.c line 162 at r1 (raw file):

	CORE_LOG_HARK("pid %d: program: %s", getpid(),
		util_getexecname(namepath, PATH_MAX));
#endif	/* DEBUG */

Suggestion:

#ifdef DEBUG
	if (log_level != NULL || log_file != NULL) {
		ret = core_log_set_function(out_legacy, NULL);
		if (ret) {
			CORE_LOG_FATAL("Cannot set legacy log function");
		}
	}
	static char namepath[PATH_MAX];
	CORE_LOG_HARK("pid %d: program: %s", getpid(),
		util_getexecname(namepath, PATH_MAX));
#endif	/* DEBUG */

src/test/traces/custom_file0.log.match line 3 at r1 (raw file):

$(nW) <1> $(nW) $(nW) src version: $(nW)
$(nW) <1> $(nW) $(nW) compiled with support for shutdown state
$(nW) <1> $(nW) $(nW) compiled with libndctl 63+

Why are these lines $(OPT) in a few other tests but not here?

Code quote:

$(nW) <1> $(nW) $(nW) compiled with support for shutdown state
$(nW) <1> $(nW) $(nW) compiled with libndctl 63+

src/test/traces/redir_stderr2.log.match line 3 at r1 (raw file):

$(nW) <1> $(nW) $(nW) src version: $(nW)
$(nW) <1> $(nW) $(nW) compiled with support for shutdown state
$(nW) <1> $(nW) $(nW) compiled with libndctl 63+

.

Code quote:

$(nW) <1> $(nW) $(nW) compiled with support for shutdown state
$(nW) <1> $(nW) $(nW) compiled with libndctl 63+

src/test/traces/redir_stderr3.log.match line 3 at r1 (raw file):

$(nW) <1> $(nW) $(nW) src version: $(nW)
$(nW) <1> $(nW) $(nW) compiled with support for shutdown state
$(nW) <1> $(nW) $(nW) compiled with libndctl 63+

.

Code quote:

$(nW) <1> $(nW) $(nW) compiled with support for shutdown state
$(nW) <1> $(nW) $(nW) compiled with libndctl 63+

src/test/traces/redir_stderr4.log.match line 3 at r1 (raw file):

$(nW) <1> $(nW) $(nW) src version: $(nW)
$(nW) <1> $(nW) $(nW) compiled with support for shutdown state
$(nW) <1> $(nW) $(nW) compiled with libndctl 63+

.

Code quote:

$(nW) <1> $(nW) $(nW) compiled with support for shutdown state
$(nW) <1> $(nW) $(nW) compiled with libndctl 63+

src/test/traces/redir_stderr5.log.match line 3 at r1 (raw file):

$(nW) <1> $(nW) $(nW) src version: $(nW)
$(nW) <1> $(nW) $(nW) compiled with support for shutdown state
$(nW) <1> $(nW) $(nW) compiled with libndctl 63+

.

Code quote:

$(nW) <1> $(nW) $(nW) compiled with support for shutdown state
$(nW) <1> $(nW) $(nW) compiled with libndctl 63+

Signed-off-by: Tomasz Gromadzki <tomasz.gromadzki@intel.com>
Copy link
Contributor Author

@grom72 grom72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @janekmi)


src/core/out.c line 162 at r1 (raw file):

	CORE_LOG_HARK("pid %d: program: %s", getpid(),
		util_getexecname(namepath, PATH_MAX));
#endif	/* DEBUG */

Intentionally left as two separate sections as they are not related to each other.


src/test/traces/custom_file0.log.match line 3 at r1 (raw file):

Previously, janekmi (Jan Michalski) wrote…

Why are these lines $(OPT) in a few other tests but not here?

$(OPT) are needed only for build w/o ndctl, and SDS support.
We do not have such tests/build so here it is OK and $(OPT) can be removed from other locations.


src/test/traces/redir_stderr2.log.match line 3 at r1 (raw file):

Previously, janekmi (Jan Michalski) wrote…

.

.


src/test/traces/redir_stderr3.log.match line 3 at r1 (raw file):

Previously, janekmi (Jan Michalski) wrote…

.

.


src/test/traces/redir_stderr4.log.match line 3 at r1 (raw file):

Previously, janekmi (Jan Michalski) wrote…

.

.


src/test/traces/redir_stderr5.log.match line 3 at r1 (raw file):

Previously, janekmi (Jan Michalski) wrote…

.

.

Signed-off-by: Tomasz Gromadzki <tomasz.gromadzki@intel.com>
Copy link
Contributor Author

@grom72 grom72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 17 of 17 files at r1, 1 of 1 files at r2, 1 of 16 files at r3, all commit messages.
Reviewable status: 3 of 18 files reviewed, 6 unresolved discussions (waiting on @janekmi)


src/test/traces/custom_file0.log.match line 3 at r1 (raw file):

Previously, grom72 (Tomasz Gromadzki) wrote…

$(OPT) are needed only for build w/o ndctl, and SDS support.
We do not have such tests/build so here it is OK and $(OPT) can be removed from other locations.

But finally, I added it everywhere as these are optional messages.

Copy link
Contributor Author

@grom72 grom72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 12 of 16 files at r3.
Reviewable status: 15 of 18 files reviewed, 6 unresolved discussions (waiting on @janekmi)

Copy link
Contributor Author

@grom72 grom72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 16 files at r3.
Reviewable status: 17 of 18 files reviewed, 6 unresolved discussions (waiting on @janekmi)

Copy link
Contributor Author

@grom72 grom72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 16 files at r3.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @janekmi)

Signed-off-by: Tomasz Gromadzki <tomasz.gromadzki@intel.com>
This was referenced Feb 23, 2024
Copy link
Contributor Author

@grom72 grom72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r4, all commit messages.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @janekmi)

Copy link
Contributor

@janekmi janekmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐐

Reviewed 16 of 16 files at r3, 1 of 1 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @grom72)


src/core/out.c line 91 at r4 (raw file):

		if (align > 0)
			Log_alignment = (unsigned)align;
	}

Just FYI it seems both Log_prefix and Log_alignment are in use only in debug now.

Code quote:

	Log_prefix = log_prefix;

	char *log_alignment = os_getenv("PMDK_LOG_ALIGN");
	if (log_alignment) {
		int align = atoi(log_alignment);
		if (align > 0)
			Log_alignment = (unsigned)align;
	}

src/core/out.c line 124 at r4 (raw file):

		Out_fp = stderr;
	else
		setlinebuf(Out_fp);

The same for Out_fp.

Code quote:

	if (Out_fp == NULL)
		Out_fp = stderr;
	else
		setlinebuf(Out_fp);

src/test/traces/custom_file0.log.match line 3 at r1 (raw file):

Previously, grom72 (Tomasz Gromadzki) wrote…

But finally, I added it everywhere as these are optional messages.

Actually, we are building PMDK without NDCTL here: https://github.com/pmem/pmdk/blob/master/.github/workflows/pmem_tests.yml#L87
$(OPT) is ok.

@grom72 grom72 merged commit d78d854 into pmem:master Feb 23, 2024
8 checks passed
@grom72 grom72 deleted the core-log-lib-info branch February 23, 2024 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no changelog Add to skip the changelog check on your pull request sprint goal This pull request is part of the ongoing sprint
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants