stan-dev / stan

Stan development repository. The master branch contains the current release. The develop branch contains the latest stable development. See the Developer Process Wiki for details.
https://mc-stan.org
BSD 3-Clause "New" or "Revised" License
2.59k stars 370 forks source link

Redesign loggers #2579

Open syclik opened 6 years ago

syclik commented 6 years ago

Summary:

From @bob-carpenter

Our loggers should just take these, as in:

logger.info() << "Gradient evaluation took " << ...; Or we should have a polyadic info function that could look like:

logger.info("Gradient evaluation took ", deltaT, " seconds");

Description:

Our loggers were introduced as a stepping stone to getting us to a better design.

We can use this issue to discuss different designs for the loggers.

Additional Information:

cc @sakrejda

Original comment from: https://github.com/stan-dev/stan/pull/2570#r201154784

Current Version:

v2.17.1

mitzimorris commented 2 years ago

The current implementations are:

https://github.com/stan-dev/stan/blob/develop/src/stan/callbacks/logger.hpp https://github.com/stan-dev/stan/blob/develop/src/stan/callbacks/stream_logger.hpp

As used in CmdStan, the calling function instantiates a logger where debug and info messages are sent to std::cout and the rest are sent to std::cerr - https://github.com/stan-dev/cmdstan/blob/4a34c4786d30da566ded7c4ad0e16b9ec189571a/src/cmdstan/command.hpp#L289-L290