How to log time in debug output

Tested on Ubuntu 20.04

  • Install the package moreutils: $ sudo apt install moreutils
  • Run a test and pipe its output into tool ts. Every line in output will be prefixed with datetime in current timezone.
    $ npx codeceptjs run Login_test.js --debug|ts
    Sep 06 16:16:36 CodeceptJS v2.6.10
    Sep 06 16:16:36 Using test root "/home/mirao/workspace/codeceptjs/tests/spork-publisher"
    Sep 06 16:16:36 Helpers: WebDriver, REST, Common, AppEngine, Firebase, Publisher, AuthoringTool, Mochawesome, DbHelper, Db, AssertWrapper
    Sep 06 16:16:36 Plugins: screenshotOnFail, autoDelay
    Sep 06 16:16:36 
    Sep 06 16:16:36 Login --
    Sep 06 16:16:36  › [Session] Starting singleton browser session
    Sep 06 16:16:41   Test login screen @loginScreen
    Sep 06 16:16:41     I am on page "/"
    Sep 06 16:16:50     loginPage: verifyLoginScreen 
    Sep 06 16:16:50       I wait url equals "/"
    ...

If you need colorized output, add the option --colors:

2 Likes