|
|
@@ -34,6 +34,21 @@ namespace logging {
|
|
|
class logger_impl;
|
|
|
struct logpacket;
|
|
|
|
|
|
+ /*
|
|
|
+ * The main top-level class that should be used when performing logging.
|
|
|
+ * Provides various overrides of the function log() that handle various use
|
|
|
+ * cases. In comparison with the C-Style logger, this one uses a Python style
|
|
|
+ * of string formatting.
|
|
|
+ * Currently, it is only able to support "{}", and cannot use positional,
|
|
|
+ * named, or reflection-based interpolations. Under the hood, the loggers are
|
|
|
+ * configured in a similar fashion to those in Log4J, such as PatternLayout
|
|
|
+ * and FileAppender.
|
|
|
+ * One of the useful features of this logger is the log_here macro. Log here
|
|
|
+ * uses the compiler to generate all of the necessary information for file
|
|
|
+ * name, class/namespace path, method name, and line number. It is not
|
|
|
+ * supported for the logger to learn that information on its own through
|
|
|
+ * creating a backtrace.
|
|
|
+ */
|
|
|
class logger {
|
|
|
private:
|
|
|
friend class manager;
|
|
|
@@ -43,25 +58,27 @@ namespace logging {
|
|
|
public:
|
|
|
~logger();
|
|
|
|
|
|
+ void log(level ll, char const * str) { log(ll, message(str)); }
|
|
|
+ void log(level ll, std::string const & str) { log(ll, message(str)); }
|
|
|
+
|
|
|
template <typename... Args>
|
|
|
- inline void log(level ll, std::string const & interp, Args &&... args) {
|
|
|
+ void log(level ll, std::string const & interp, Args &&... args) {
|
|
|
log(ll, message(interp, std::forward<Args>(args)...));
|
|
|
}
|
|
|
|
|
|
template <typename... Args>
|
|
|
- inline void log(level ll, location_info const & info,
|
|
|
- std::string const & interp, Args &&... args) {
|
|
|
+ void log(level ll, location_info const & info, std::string const & interp,
|
|
|
+ Args &&... args) {
|
|
|
log(ll, info, message(interp, std::forward<Args>(args)...));
|
|
|
}
|
|
|
|
|
|
- void log(level ll, message const &);
|
|
|
-
|
|
|
void flush();
|
|
|
|
|
|
protected:
|
|
|
logger(std::string const & name, std::shared_ptr<logger_impl> impl);
|
|
|
|
|
|
private:
|
|
|
+ void log(level ll, message const &);
|
|
|
void log(level ll, location_info const & info, message const &);
|
|
|
};
|
|
|
}
|