return long
return long

Reputation: 193

Gauge plugin logger

I'm using gauge(python) to test my WebSocket API and I try to print some info in my step implementation code by python logging module to help debug, however, I get nothing.

How to log info in python step implementation code?

Thanks.

Upvotes: 1

Views: 155

Answers (1)

derdualist
derdualist

Reputation: 1

I have no direct solution for python logging, but this works:

  1. Write into the test report. You need to install the plugin for that: gauge install html-report

    from getgauge.python import Messages
    Messages.write_message("message")
    

    This accepts HTML, so you might want to format the message, f.i. if you want to preserve whitespace.

  2. Just use print("message")
    this will write the output into the console, but gauge will also redirect it to logs/gauge.log. It will not write it into the report. Unfortunately, it will cut off leading whitespace.

Upvotes: 0

Related Questions