Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 660cc66

Browse files
committed
TRACE: Print function name at the end
1 parent f041ec6 commit 660cc66

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/debug.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,21 @@ Log::Log() {}
99

1010
std::ostringstream& Log::Get(TLogLevel level, void *p, const char *f, const char *filen, int lineno)
1111
{
12-
os << "[NODESASS@" << uv_thread_self() << "] " << p << ":" << f << " " << filen << ":" << lineno << " ";
12+
os << "[NODESASS@" << uv_thread_self() << "] " << p << ":" << filen << ":" << lineno << " ";
13+
func = f;
1314
messageLevel = level;
1415
return os;
1516
}
1617
std::ostringstream& Log::Get(TLogLevel level, const char *f, const char *filen, int lineno)
1718
{
18-
os << "[NODESASS@" << uv_thread_self() << "] " << f << " " << filen << ":" << lineno << " ";
19+
os << "[NODESASS@" << uv_thread_self() << "] " << filen << ":" << lineno << " ";
20+
func = f;
1921
messageLevel = level;
2022
return os;
2123
}
2224
Log::~Log()
2325
{
24-
os << std::endl;
26+
os << " (" << func << ")" << std::endl;
2527
fprintf(stderr, "%s", os.str().c_str());
2628
fflush(stderr);
2729
}

src/debug.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@ class Log
1212
virtual ~Log();
1313
std::ostringstream& Get(TLogLevel level, void *p, const char *f, const char *filen, int lineno);
1414
std::ostringstream& Get(TLogLevel level, const char *f, const char *filen, int lineno);
15-
public:
1615
protected:
1716
std::ostringstream os;
1817
private:
1918
Log(const Log&);
2019
Log& operator =(const Log&);
21-
private:
2220
TLogLevel messageLevel;
21+
const char *func;
2322
};
2423

2524
// Visual Studio 2013 does not like __func__

0 commit comments

Comments
 (0)