Use different Logs in wafPassing extra arguments to Waf scriptHave waf command use targets from a different waf commandDependencies between different environments in Waf?Could not configure a C compiler (Windows)ndnSIM2.0 appear error when I use “./waf”How to install waf?Create waf size featureSpecify different compilers in wafSpecify the lib version in waf check_ccWhere are wafs include stored
Converting Geographic Coordinates into Lambert2008 coordinates
Can European countries bypass the EU and make their own individual trade deal with the U.S.?
How did researchers find articles before the Internet and the computer era?
Journal standards vs. personal standards
Are gliders susceptible to bird strikes?
How do we separate rules of logic from non-logical constraints?
Security Patch SUPEE-11155 - Possible issues?
Who voices the character "Finger" in The Fifth Element?
What game is this character in the Pixels movie from?
Just graduated with a master’s degree, but I internalised nothing
Divergent Series & Continued Fraction (from Gauss' Mathematical Diary)
How can a valley surrounded by mountains be fertile and rainy?
Find the radius of the hoop.
How could a satellite follow earth around the sun while staying outside of earth's orbit?
Have any large aeroplanes been landed - safely and without damage - in locations that they could not be flown away from?
Script executes loop only once
Do home values typically rise and fall at a consistent percent?
Different budgets within roommate group
Can a stressful Wish's Strength reduction be cured early by a Greater Restoration spell?
Sacrifice blocking creature before damage is dealt no longer working (MtG Arena)?
What's the safest way to inform a new user of their password on an invite-only website?
Losing queen and then winning the game
Most important new papers in computational complexity
Do the 26 richest billionaires own as much wealth as the poorest 3.8 billion people?
Use different Logs in waf
Passing extra arguments to Waf scriptHave waf command use targets from a different waf commandDependencies between different environments in Waf?Could not configure a C compiler (Windows)ndnSIM2.0 appear error when I use “./waf”How to install waf?Create waf size featureSpecify different compilers in wafSpecify the lib version in waf check_ccWhere are wafs include stored
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I added a custom logger to the waf build command as seen below. The output of this wscript
is shown below.
But I want to have the normal waf logger to print on the terminal, and the normal + custom logger output to be written to the log file. Is this possible? The problem is, that the normal output is most times sufficient, and the added verbosity by the custom logger slows down the build quite a lot.
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
top = '.'
out = 'build'
VERSION = '0.0.0'
APPNAME = 'app'
from waflib import Configure, Logs
import logging
Configure.autoconfig = True
def options(opt):
opt.load('compiler_c')
def configure(conf):
conf.load('compiler_c')
conf.path.make_node('main.c').write(
'#include <stdio.h>nnint main(int argc, char* argv[]) n return 0;nn')
def build(bld):
import sys
import os
log_file = os.path.join(out, 'build.log')
bld.logger = Logs.make_logger(log_file, out)
hdlr = logging.StreamHandler(sys.stdout)
formatter = logging.Formatter('%(message)s')
hdlr.setFormatter(formatter)
bld.logger.addHandler(hdlr)
bld.program(target='app', source='main.c')
The produced output is like this:
$ python waf
Configuring the project
Setting top to : /cygdrive/d/log
Setting out to : /cygdrive/d/log/build
Checking for 'gcc' (C compiler) : /usr/bin/gcc
Waf: Entering directory `/cygdrive/d/log/build'
[1/2] Compiling main.c
['/usr/bin/gcc', '../main.c', '-c', '-o/cygdrive/d/log/build/main.c.1.o']
[2/2] Linking build/app.exe
['/usr/bin/gcc', '-Wl,--enable-auto-import', 'main.c.1.o', '-o/cygdrive/d/log/build/app.exe', '-Wl,-Bstatic', '-Wl,-Bdynamic']
Waf: Leaving directory `/cygdrive/d/log/build'
'build' finished successfully (0.473s)
What I need is a terminal output like this:
[1/2] Compiling main.c
[2/2] Linking build/app.exe
and a log file output like this:
[1/2] Compiling [32mmain.c[0m
['/usr/bin/gcc', '../main.c', '-c', '-o/cygdrive/d/log/build/main.c.1.o']
[2/2] Linking [33mbuild/app.exe[0m
['/usr/bin/gcc', '-Wl,--enable-auto-import', 'main.c.1.o', '-o/cygdrive/d/log/build/app.exe', '-Wl,-Bstatic', '-Wl,-Bdynamic']
Bonus: How can the non printable characters be removed only in the log file output?
waf
add a comment |
I added a custom logger to the waf build command as seen below. The output of this wscript
is shown below.
But I want to have the normal waf logger to print on the terminal, and the normal + custom logger output to be written to the log file. Is this possible? The problem is, that the normal output is most times sufficient, and the added verbosity by the custom logger slows down the build quite a lot.
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
top = '.'
out = 'build'
VERSION = '0.0.0'
APPNAME = 'app'
from waflib import Configure, Logs
import logging
Configure.autoconfig = True
def options(opt):
opt.load('compiler_c')
def configure(conf):
conf.load('compiler_c')
conf.path.make_node('main.c').write(
'#include <stdio.h>nnint main(int argc, char* argv[]) n return 0;nn')
def build(bld):
import sys
import os
log_file = os.path.join(out, 'build.log')
bld.logger = Logs.make_logger(log_file, out)
hdlr = logging.StreamHandler(sys.stdout)
formatter = logging.Formatter('%(message)s')
hdlr.setFormatter(formatter)
bld.logger.addHandler(hdlr)
bld.program(target='app', source='main.c')
The produced output is like this:
$ python waf
Configuring the project
Setting top to : /cygdrive/d/log
Setting out to : /cygdrive/d/log/build
Checking for 'gcc' (C compiler) : /usr/bin/gcc
Waf: Entering directory `/cygdrive/d/log/build'
[1/2] Compiling main.c
['/usr/bin/gcc', '../main.c', '-c', '-o/cygdrive/d/log/build/main.c.1.o']
[2/2] Linking build/app.exe
['/usr/bin/gcc', '-Wl,--enable-auto-import', 'main.c.1.o', '-o/cygdrive/d/log/build/app.exe', '-Wl,-Bstatic', '-Wl,-Bdynamic']
Waf: Leaving directory `/cygdrive/d/log/build'
'build' finished successfully (0.473s)
What I need is a terminal output like this:
[1/2] Compiling main.c
[2/2] Linking build/app.exe
and a log file output like this:
[1/2] Compiling [32mmain.c[0m
['/usr/bin/gcc', '../main.c', '-c', '-o/cygdrive/d/log/build/main.c.1.o']
[2/2] Linking [33mbuild/app.exe[0m
['/usr/bin/gcc', '-Wl,--enable-auto-import', 'main.c.1.o', '-o/cygdrive/d/log/build/app.exe', '-Wl,-Bstatic', '-Wl,-Bdynamic']
Bonus: How can the non printable characters be removed only in the log file output?
waf
add a comment |
I added a custom logger to the waf build command as seen below. The output of this wscript
is shown below.
But I want to have the normal waf logger to print on the terminal, and the normal + custom logger output to be written to the log file. Is this possible? The problem is, that the normal output is most times sufficient, and the added verbosity by the custom logger slows down the build quite a lot.
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
top = '.'
out = 'build'
VERSION = '0.0.0'
APPNAME = 'app'
from waflib import Configure, Logs
import logging
Configure.autoconfig = True
def options(opt):
opt.load('compiler_c')
def configure(conf):
conf.load('compiler_c')
conf.path.make_node('main.c').write(
'#include <stdio.h>nnint main(int argc, char* argv[]) n return 0;nn')
def build(bld):
import sys
import os
log_file = os.path.join(out, 'build.log')
bld.logger = Logs.make_logger(log_file, out)
hdlr = logging.StreamHandler(sys.stdout)
formatter = logging.Formatter('%(message)s')
hdlr.setFormatter(formatter)
bld.logger.addHandler(hdlr)
bld.program(target='app', source='main.c')
The produced output is like this:
$ python waf
Configuring the project
Setting top to : /cygdrive/d/log
Setting out to : /cygdrive/d/log/build
Checking for 'gcc' (C compiler) : /usr/bin/gcc
Waf: Entering directory `/cygdrive/d/log/build'
[1/2] Compiling main.c
['/usr/bin/gcc', '../main.c', '-c', '-o/cygdrive/d/log/build/main.c.1.o']
[2/2] Linking build/app.exe
['/usr/bin/gcc', '-Wl,--enable-auto-import', 'main.c.1.o', '-o/cygdrive/d/log/build/app.exe', '-Wl,-Bstatic', '-Wl,-Bdynamic']
Waf: Leaving directory `/cygdrive/d/log/build'
'build' finished successfully (0.473s)
What I need is a terminal output like this:
[1/2] Compiling main.c
[2/2] Linking build/app.exe
and a log file output like this:
[1/2] Compiling [32mmain.c[0m
['/usr/bin/gcc', '../main.c', '-c', '-o/cygdrive/d/log/build/main.c.1.o']
[2/2] Linking [33mbuild/app.exe[0m
['/usr/bin/gcc', '-Wl,--enable-auto-import', 'main.c.1.o', '-o/cygdrive/d/log/build/app.exe', '-Wl,-Bstatic', '-Wl,-Bdynamic']
Bonus: How can the non printable characters be removed only in the log file output?
waf
I added a custom logger to the waf build command as seen below. The output of this wscript
is shown below.
But I want to have the normal waf logger to print on the terminal, and the normal + custom logger output to be written to the log file. Is this possible? The problem is, that the normal output is most times sufficient, and the added verbosity by the custom logger slows down the build quite a lot.
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
top = '.'
out = 'build'
VERSION = '0.0.0'
APPNAME = 'app'
from waflib import Configure, Logs
import logging
Configure.autoconfig = True
def options(opt):
opt.load('compiler_c')
def configure(conf):
conf.load('compiler_c')
conf.path.make_node('main.c').write(
'#include <stdio.h>nnint main(int argc, char* argv[]) n return 0;nn')
def build(bld):
import sys
import os
log_file = os.path.join(out, 'build.log')
bld.logger = Logs.make_logger(log_file, out)
hdlr = logging.StreamHandler(sys.stdout)
formatter = logging.Formatter('%(message)s')
hdlr.setFormatter(formatter)
bld.logger.addHandler(hdlr)
bld.program(target='app', source='main.c')
The produced output is like this:
$ python waf
Configuring the project
Setting top to : /cygdrive/d/log
Setting out to : /cygdrive/d/log/build
Checking for 'gcc' (C compiler) : /usr/bin/gcc
Waf: Entering directory `/cygdrive/d/log/build'
[1/2] Compiling main.c
['/usr/bin/gcc', '../main.c', '-c', '-o/cygdrive/d/log/build/main.c.1.o']
[2/2] Linking build/app.exe
['/usr/bin/gcc', '-Wl,--enable-auto-import', 'main.c.1.o', '-o/cygdrive/d/log/build/app.exe', '-Wl,-Bstatic', '-Wl,-Bdynamic']
Waf: Leaving directory `/cygdrive/d/log/build'
'build' finished successfully (0.473s)
What I need is a terminal output like this:
[1/2] Compiling main.c
[2/2] Linking build/app.exe
and a log file output like this:
[1/2] Compiling [32mmain.c[0m
['/usr/bin/gcc', '../main.c', '-c', '-o/cygdrive/d/log/build/main.c.1.o']
[2/2] Linking [33mbuild/app.exe[0m
['/usr/bin/gcc', '-Wl,--enable-auto-import', 'main.c.1.o', '-o/cygdrive/d/log/build/app.exe', '-Wl,-Bstatic', '-Wl,-Bdynamic']
Bonus: How can the non printable characters be removed only in the log file output?
waf
waf
edited Mar 25 at 13:57
neuro
12.2k3 gold badges29 silver badges56 bronze badges
12.2k3 gold badges29 silver badges56 bronze badges
asked Mar 21 at 9:01
wafwafwafwafwafwaf
449 bronze badges
449 bronze badges
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55276842%2fuse-different-logs-in-waf%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55276842%2fuse-different-logs-in-waf%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown