|
|
|
@ -36,10 +36,21 @@ namespace dlib
|
|
|
|
|
name[19] = '\0';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool operator< (const log_level& rhs) const { return priority < rhs.priority; }
|
|
|
|
|
bool operator<=(const log_level& rhs) const { return priority <= rhs.priority; }
|
|
|
|
|
bool operator> (const log_level& rhs) const { return priority > rhs.priority; }
|
|
|
|
|
bool operator>=(const log_level& rhs) const { return priority >= rhs.priority; }
|
|
|
|
|
|
|
|
|
|
int priority;
|
|
|
|
|
char name[20];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
inline std::ostream& operator<< (std::ostream& out, const log_level& item)
|
|
|
|
|
{
|
|
|
|
|
out << item.name;
|
|
|
|
|
return out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const log_level LALL (std::numeric_limits<int>::min(),"ALL");
|
|
|
|
|
const log_level LNONE (std::numeric_limits<int>::max(),"NONE");
|
|
|
|
|
const log_level LTRACE(-100,"TRACE");
|
|
|
|
@ -79,6 +90,16 @@ namespace dlib
|
|
|
|
|
const char* message_to_log)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
template <
|
|
|
|
|
typename T
|
|
|
|
|
>
|
|
|
|
|
void set_all_logging_output_hooks (
|
|
|
|
|
T& object
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
set_all_logging_output_hooks(object, &T::log);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
class logger
|
|
|
|
|