Skip to content

Commit e4d3adf

Browse files
jmirabelOlivier Stasse
authored andcommitted
Provide backward compatibility + reorganize headers.
1 parent f17106c commit e4d3adf

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

include/dynamic-graph/logger.h

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,18 @@ enum MsgType {
4545
/* --- INCLUDE --------------------------------------------------------- */
4646
/* --------------------------------------------------------------------- */
4747

48+
#include <map>
49+
/// \todo These 3 headers should be removed.
50+
#include <fstream>
51+
#include <iomanip> // std::setprecision
52+
#include <sstream>
53+
4854
#include <boost/assign.hpp>
4955
#include <boost/preprocessor/stringize.hpp>
56+
57+
#include <dynamic-graph/deprecated.hh>
5058
#include <dynamic-graph/linear-algebra.h>
5159
#include <dynamic-graph/real-time-logger-def.h>
52-
#include <fstream>
53-
#include <iomanip> // std::setprecision
54-
#include <map>
55-
#include <sstream>
5660

5761
namespace dynamicgraph {
5862

@@ -217,6 +221,14 @@ class Logger {
217221
*/
218222
void sendMsg(std::string msg, MsgType type, const std::string& lineId = "");
219223

224+
/** \deprecated instead, use
225+
* \code
226+
* stream(type, lineId) << msg << '\n';
227+
* \endcode
228+
*/
229+
void sendMsg(std::string msg, MsgType type, const std::string& file,
230+
int line) DYNAMIC_GRAPH_DEPRECATED;
231+
220232
/** Set the sampling time at which the method countdown()
221233
* is going to be called. */
222234
bool setTimeSample(double t);

src/debug/logger.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ void Logger::sendMsg(std::string msg, MsgType type, const std::string &lineId) {
4343
stream(type, lineId) << msg << '\n';
4444
}
4545

46+
void Logger::sendMsg(std::string msg, MsgType type, const std::string &file,
47+
int line) {
48+
std::ostringstream oss;
49+
oss << file << line;
50+
stream(type, oss.str()) << msg << '\n';
51+
}
52+
4653
bool Logger::setTimeSample(double t) {
4754
if (t <= 0.0)
4855
return false;

0 commit comments

Comments
 (0)