Skip to content

Commit 583ee2a

Browse files
pcaspersjenkins
authored andcommitted
QPR-12119 make source private and remove lock
1 parent 9191c9d commit 583ee2a

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

OREData/ored/utilities/log.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,7 @@ void Log::removeAllLoggers() {
336336
independentLoggers_.clear();
337337
}
338338

339-
string Log::source(const char* filename, int lineNo) {
340-
boost::shared_lock<boost::shared_mutex> lock(mutex_);
339+
string Log::source(const char* filename, int lineNo) const {
341340
string filepath;
342341
if (rootPath_.empty()) {
343342
filepath = filename;

OREData/ored/utilities/log.hpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -428,19 +428,17 @@ class Log : public QuantLib::Singleton<Log, std::integral_constant<bool, true>>
428428
*/
429429
void removeAllLoggers();
430430

431-
std::string source(const char* filename, int lineNo);
432-
433431
void addExcludeFilter(const std::string&, const std::function<bool(const std::string&)>);
434432

435433
void removeExcludeFilter(const std::string&);
436434

437435
bool checkExcludeFilters(const std::string&);
438436

439-
//! macro utility function - do not use directly
437+
//! macro utility function - do not use directly, not thread safe
440438
void header(unsigned m, const char* filename, int lineNo);
441-
//! macro utility function - do not use directly
439+
//! macro utility function - do not use directly, not thread safe
442440
std::ostream& logStream() { return ls_; }
443-
//! macro utility function - do not use directly
441+
//! macro utility function - do not use directly, not thread safe
444442
void log(unsigned m);
445443

446444
//! mutex to acquire locks
@@ -500,6 +498,9 @@ class Log : public QuantLib::Singleton<Log, std::integral_constant<bool, true>>
500498
private:
501499
Log();
502500

501+
// not thread safe
502+
std::string source(const char* filename, int lineNo) const;
503+
503504
std::map<std::string, boost::shared_ptr<Logger>> loggers_;
504505
std::map<std::string, boost::shared_ptr<IndependentLogger>> independentLoggers_;
505506
bool enabled_;

0 commit comments

Comments
 (0)