refactor: Rename param for Log::insert to make adoption clearer
This commit is contained in:
parent
0bca094fce
commit
f56a3ba305
3 changed files with 14 additions and 19 deletions
|
|
@ -11,9 +11,10 @@
|
||||||
"codesigning",
|
"codesigning",
|
||||||
"Compat",
|
"Compat",
|
||||||
"contribs",
|
"contribs",
|
||||||
|
"daemonized",
|
||||||
"Daun",
|
"Daun",
|
||||||
"Devs",
|
|
||||||
"Deskflow",
|
"Deskflow",
|
||||||
|
"Devs",
|
||||||
"distro",
|
"distro",
|
||||||
"distros",
|
"distros",
|
||||||
"dmgbuild",
|
"dmgbuild",
|
||||||
|
|
@ -48,6 +49,7 @@
|
||||||
"Oleksandr",
|
"Oleksandr",
|
||||||
"Olena",
|
"Olena",
|
||||||
"outputdir",
|
"outputdir",
|
||||||
|
"outputter",
|
||||||
"pacman",
|
"pacman",
|
||||||
"Petroules",
|
"Petroules",
|
||||||
"Pixmap",
|
"Pixmap",
|
||||||
|
|
|
||||||
|
|
@ -208,27 +208,18 @@ void Log::print(const char *file, int line, const char *fmt, ...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Log::insert(ILogOutputter *outputter, bool alwaysAtHead)
|
void Log::insert(ILogOutputter *adoptedOutputter, bool alwaysAtHead)
|
||||||
{
|
{
|
||||||
assert(outputter != NULL);
|
assert(adoptedOutputter != NULL);
|
||||||
|
|
||||||
ArchMutexLock lock(m_mutex);
|
ArchMutexLock lock(m_mutex);
|
||||||
if (alwaysAtHead) {
|
if (alwaysAtHead) {
|
||||||
m_alwaysOutputters.push_front(outputter);
|
m_alwaysOutputters.push_front(adoptedOutputter);
|
||||||
} else {
|
} else {
|
||||||
m_outputters.push_front(outputter);
|
m_outputters.push_front(adoptedOutputter);
|
||||||
}
|
}
|
||||||
|
|
||||||
outputter->open(kAppName);
|
adoptedOutputter->open(kAppName);
|
||||||
|
|
||||||
// Issue 41
|
|
||||||
// don't show log unless user requests it, as some users find this
|
|
||||||
// feature irritating (i.e. when they lose network connectivity).
|
|
||||||
// in windows the log window can be displayed by selecting "show log"
|
|
||||||
// from the deskflow system tray icon.
|
|
||||||
// if this causes problems for other architectures, then a different
|
|
||||||
// work around should be attempted.
|
|
||||||
// outputter->show(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Log::remove(ILogOutputter *outputter)
|
void Log::remove(ILogOutputter *outputter)
|
||||||
|
|
|
||||||
|
|
@ -42,10 +42,12 @@ public:
|
||||||
//! @name manipulators
|
//! @name manipulators
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
//! Add an outputter to the head of the list
|
//! Add an outputter to the head of the list and adopts it.
|
||||||
/*!
|
/*!
|
||||||
Inserts an outputter to the head of the outputter list. When the
|
Inserts an outputter to the head of the outputter list. The outputter
|
||||||
logger writes a message, it goes to the outputter at the head of
|
is deleted when Log destructor is called.
|
||||||
|
|
||||||
|
When the logger writes a message, it goes to the outputter at the head of
|
||||||
the outputter list. If that outputter's \c write() method returns
|
the outputter list. If that outputter's \c write() method returns
|
||||||
true then it also goes to the next outputter, as so on until an
|
true then it also goes to the next outputter, as so on until an
|
||||||
outputter returns false or there are no more outputters. Outputters
|
outputter returns false or there are no more outputters. Outputters
|
||||||
|
|
@ -57,7 +59,7 @@ public:
|
||||||
By default, the logger has one outputter installed which writes to
|
By default, the logger has one outputter installed which writes to
|
||||||
the console.
|
the console.
|
||||||
*/
|
*/
|
||||||
void insert(ILogOutputter *adopted, bool alwaysAtHead = false);
|
void insert(ILogOutputter *adoptedOutputter, bool alwaysAtHead = false);
|
||||||
|
|
||||||
//! Remove an outputter from the list
|
//! Remove an outputter from the list
|
||||||
/*!
|
/*!
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue