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;








1















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?










share|improve this question






























    1















    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?










    share|improve this question


























      1












      1








      1








      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?










      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      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






















          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
          );



          );













          draft saved

          draft discarded


















          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.



















          draft saved

          draft discarded
















































          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.




          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현