redox icon indicating copy to clipboard operation
redox copied to clipboard

Lacking examples for logs management

Open Plaristote opened this issue 9 years ago • 1 comments

On a lot of HGET request, I expect my response to be nil. Unfortunately, when that happens, I get a log message such as:

(2016-02.05 13:38:55) [Warning] HGET 37108 8: Nil reply.

The homepage of redox says that the logs can be managed and redirected at will, but there is no documentation showing how to do so.

Maybe I'm not supposed to do an HGET if I know the response might be nil, but in an case I'm developing a C++ web server, and I need to be able to redirect redox's (or hiredis ?) logs to whatever stream the server is using.

Maybe there should be an example on how to do that on the project's homepage.

Plaristote avatar Feb 05 '16 12:02 Plaristote

Hello. Redirecting the log stream is very simple. See the constructor of client.hpp:

  /**
  * Constructor. Optionally specify a log stream and a log level.
  */
  Redox(std::ostream &log_stream = std::cout, log::Level log_level = log::Warning);

I will make a note about adding an example, but I think it may be overkill

hmartiro avatar Feb 15 '16 03:02 hmartiro