Project

General

Profile

Feature #2740

shorten logging filenames when built outside of the source tree

Added by neels 7 months ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
-
Target version:
-
Start date:
12/12/2017
Due date:
% Done:

0%

Estimated time:
Spec Reference:

Description

conversation from https://gerrit.osmocom.org/5265

Why do we see ../../../ in the file names? We switched logging to __BASE_FILE__ to avoid this on src vs.  build dir builds..

I have no idea, maybe __BASE_FILE__ isn't working out as expected? I build in this dir topology and usually see the long ../../ paths:

  ./src/osmo-foo/configure.ac
  ./make/osmo-foo/Makefile

Can confirm though that LOGP macros use __BASE_FILE__.

"__BASE_FILE__

    This macro expands to the name of the main input file, in the form of a C string constant. This is the source file that was specified on the command line of the preprocessor or C compiler.
" 

So it's not related to stripping path elements. If we did something like 'cd $(srcdir); gcc -o $(builddir)/thing.o' the paths would go shorter. I'm not so sure on when __BASE_FILE__ != __FILE__, maybe we should go back to __FILE__?

stackoverflow has 

  #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)

which would iterate around in file paths for each log statement. compared to terminal output that's probably neglectable.

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)