style fix

This commit is contained in:
Günter Obiltschnig
2020-02-13 22:08:44 +01:00
parent 23da8c21c9
commit dea91c8105

View File

@@ -73,7 +73,7 @@ class Foundation_API Logger: public Channel
/// are used. The macros also add the source file path and line /// are used. The macros also add the source file path and line
/// number into the log message so that it is available to formatters. /// number into the log message so that it is available to formatters.
/// Variants of these macros that allow message formatting with Poco::format() /// Variants of these macros that allow message formatting with Poco::format()
/// are also available. /// are also available.
/// ///
/// Examples: /// Examples:
/// poco_warning(logger, "This is a warning"); /// poco_warning(logger, "This is a warning");
@@ -88,20 +88,20 @@ public:
void setChannel(Channel::Ptr pChannel); void setChannel(Channel::Ptr pChannel);
/// Attaches the given Channel to the Logger. /// Attaches the given Channel to the Logger.
Channel::Ptr getChannel() const; Channel::Ptr getChannel() const;
/// Returns the Channel attached to the logger. /// Returns the Channel attached to the logger.
void setLevel(int level); void setLevel(int level);
/// Sets the Logger's log level. /// Sets the Logger's log level.
/// ///
/// See Message::Priority for valid log levels. /// See Message::Priority for valid log levels.
/// Setting the log level to zero turns off /// Setting the log level to zero turns off
/// logging for that Logger. /// logging for that Logger.
int getLevel() const; int getLevel() const;
/// Returns the Logger's log level. /// Returns the Logger's log level.
void setLevel(const std::string& level); void setLevel(const std::string& level);
/// Sets the Logger's log level using a symbolic value. /// Sets the Logger's log level using a symbolic value.
/// ///
@@ -126,17 +126,17 @@ public:
void log(const Message& msg); void log(const Message& msg);
/// Logs the given message if its priority is /// Logs the given message if its priority is
/// greater than or equal to the Logger's log level. /// greater than or equal to the Logger's log level.
void log(const Exception& exc); void log(const Exception& exc);
/// Logs the given exception with priority PRIO_ERROR. /// Logs the given exception with priority PRIO_ERROR.
void log(const Exception& exc, const char* file, int line); void log(const Exception& exc, const char* file, int line);
/// Logs the given exception with priority PRIO_ERROR. /// Logs the given exception with priority PRIO_ERROR.
/// ///
/// File must be a static string, such as the value of /// File must be a static string, such as the value of
/// the __FILE__ macro. The string is not copied /// the __FILE__ macro. The string is not copied
/// internally for performance reasons. /// internally for performance reasons.
void fatal(const std::string& msg); void fatal(const std::string& msg);
/// If the Logger's log level is at least PRIO_FATAL, /// If the Logger's log level is at least PRIO_FATAL,
/// creates a Message with priority PRIO_FATAL /// creates a Message with priority PRIO_FATAL
@@ -151,10 +151,10 @@ public:
/// ///
/// File must be a static string, such as the value of /// File must be a static string, such as the value of
/// the __FILE__ macro. The string is not copied /// the __FILE__ macro. The string is not copied
/// internally for performance reasons. /// internally for performance reasons.
template <typename T, typename... Args> template <typename T, typename... Args>
void fatal(const std::string &fmt, T arg1, Args&&... args) void fatal(const std::string& fmt, T arg1, Args&&... args)
{ {
log(Poco::format(fmt, arg1, std::forward<Args>(args)...), Message::PRIO_FATAL); log(Poco::format(fmt, arg1, std::forward<Args>(args)...), Message::PRIO_FATAL);
} }
@@ -173,10 +173,10 @@ public:
/// ///
/// File must be a static string, such as the value of /// File must be a static string, such as the value of
/// the __FILE__ macro. The string is not copied /// the __FILE__ macro. The string is not copied
/// internally for performance reasons. /// internally for performance reasons.
template <typename T, typename... Args> template <typename T, typename... Args>
void critical(const std::string &fmt, T arg1, Args&&... args) void critical(const std::string& fmt, T arg1, Args&&... args)
{ {
log(Poco::format(fmt, arg1, std::forward<Args>(args)...), Message::PRIO_CRITICAL); log(Poco::format(fmt, arg1, std::forward<Args>(args)...), Message::PRIO_CRITICAL);
} }
@@ -195,10 +195,10 @@ public:
/// ///
/// File must be a static string, such as the value of /// File must be a static string, such as the value of
/// the __FILE__ macro. The string is not copied /// the __FILE__ macro. The string is not copied
/// internally for performance reasons. /// internally for performance reasons.
template <typename T, typename... Args> template <typename T, typename... Args>
void error(const std::string &fmt, T arg1, Args&&... args) void error(const std::string& fmt, T arg1, Args&&... args)
{ {
log(Poco::format(fmt, arg1, std::forward<Args>(args)...), Message::PRIO_ERROR); log(Poco::format(fmt, arg1, std::forward<Args>(args)...), Message::PRIO_ERROR);
} }
@@ -217,10 +217,10 @@ public:
/// ///
/// File must be a static string, such as the value of /// File must be a static string, such as the value of
/// the __FILE__ macro. The string is not copied /// the __FILE__ macro. The string is not copied
/// internally for performance reasons. /// internally for performance reasons.
template <typename T, typename... Args> template <typename T, typename... Args>
void warning(const std::string &fmt, T arg1, Args&&... args) void warning(const std::string& fmt, T arg1, Args&&... args)
{ {
log(Poco::format(fmt, arg1, std::forward<Args>(args)...), Message::PRIO_WARNING); log(Poco::format(fmt, arg1, std::forward<Args>(args)...), Message::PRIO_WARNING);
} }
@@ -239,10 +239,10 @@ public:
/// ///
/// File must be a static string, such as the value of /// File must be a static string, such as the value of
/// the __FILE__ macro. The string is not copied /// the __FILE__ macro. The string is not copied
/// internally for performance reasons. /// internally for performance reasons.
template <typename T, typename... Args> template <typename T, typename... Args>
void notice(const std::string &fmt, T arg1, Args&&... args) void notice(const std::string& fmt, T arg1, Args&&... args)
{ {
log(Poco::format(fmt, arg1, std::forward<Args>(args)...), Message::PRIO_NOTICE); log(Poco::format(fmt, arg1, std::forward<Args>(args)...), Message::PRIO_NOTICE);
} }
@@ -261,10 +261,10 @@ public:
/// ///
/// File must be a static string, such as the value of /// File must be a static string, such as the value of
/// the __FILE__ macro. The string is not copied /// the __FILE__ macro. The string is not copied
/// internally for performance reasons. /// internally for performance reasons.
template <typename T, typename... Args> template <typename T, typename... Args>
void information(const std::string &fmt, T arg1, Args&&... args) void information(const std::string& fmt, T arg1, Args&&... args)
{ {
log(Poco::format(fmt, arg1, std::forward<Args>(args)...), Message::PRIO_INFORMATION); log(Poco::format(fmt, arg1, std::forward<Args>(args)...), Message::PRIO_INFORMATION);
} }
@@ -283,10 +283,10 @@ public:
/// ///
/// File must be a static string, such as the value of /// File must be a static string, such as the value of
/// the __FILE__ macro. The string is not copied /// the __FILE__ macro. The string is not copied
/// internally for performance reasons. /// internally for performance reasons.
template <typename T, typename... Args> template <typename T, typename... Args>
void debug(const std::string &fmt, T arg1, Args&&... args) void debug(const std::string& fmt, T arg1, Args&&... args)
{ {
log(Poco::format(fmt, arg1, std::forward<Args>(args)...), Message::PRIO_DEBUG); log(Poco::format(fmt, arg1, std::forward<Args>(args)...), Message::PRIO_DEBUG);
} }
@@ -305,10 +305,10 @@ public:
/// ///
/// File must be a static string, such as the value of /// File must be a static string, such as the value of
/// the __FILE__ macro. The string is not copied /// the __FILE__ macro. The string is not copied
/// internally for performance reasons. /// internally for performance reasons.
template <typename T, typename... Args> template <typename T, typename... Args>
void trace(const std::string &fmt, T arg1, Args&&... args) void trace(const std::string& fmt, T arg1, Args&&... args)
{ {
log(Poco::format(fmt, arg1, std::forward<Args>(args)...), Message::PRIO_TRACE); log(Poco::format(fmt, arg1, std::forward<Args>(args)...), Message::PRIO_TRACE);
} }
@@ -317,17 +317,17 @@ public:
/// Logs the given message, followed by the data in buffer. /// Logs the given message, followed by the data in buffer.
/// ///
/// The data in buffer is written in canonical hex+ASCII form: /// The data in buffer is written in canonical hex+ASCII form:
/// Offset (4 bytes) in hexadecimal, followed by sixteen /// Offset (4 bytes) in hexadecimal, followed by sixteen
/// space-separated, two column, hexadecimal bytes, /// space-separated, two column, hexadecimal bytes,
/// followed by the same sixteen bytes as ASCII characters. /// followed by the same sixteen bytes as ASCII characters.
/// For bytes outside the range 32 .. 127, a dot is printed. /// For bytes outside the range 32 .. 127, a dot is printed.
bool is(int level) const; bool is(int level) const;
/// Returns true if at least the given log level is set. /// Returns true if at least the given log level is set.
bool fatal() const; bool fatal() const;
/// Returns true if the log level is at least PRIO_FATAL. /// Returns true if the log level is at least PRIO_FATAL.
bool critical() const; bool critical() const;
/// Returns true if the log level is at least PRIO_CRITICAL. /// Returns true if the log level is at least PRIO_CRITICAL.
@@ -353,18 +353,18 @@ public:
/// Replaces all occurrences of $0 in fmt with the string given in arg and /// Replaces all occurrences of $0 in fmt with the string given in arg and
/// returns the result. To include a dollar sign in the result string, /// returns the result. To include a dollar sign in the result string,
/// specify two dollar signs ($$) in the format string. /// specify two dollar signs ($$) in the format string.
static std::string format(const std::string& fmt, const std::string& arg0, const std::string& arg1); static std::string format(const std::string& fmt, const std::string& arg0, const std::string& arg1);
/// Replaces all occurrences of $<n> in fmt with the string given in arg<n> and /// Replaces all occurrences of $<n> in fmt with the string given in arg<n> and
/// returns the result. To include a dollar sign in the result string, /// returns the result. To include a dollar sign in the result string,
/// specify two dollar signs ($$) in the format string. /// specify two dollar signs ($$) in the format string.
static std::string format(const std::string& fmt, const std::string& arg0, const std::string& arg1, const std::string& arg2); static std::string format(const std::string& fmt, const std::string& arg0, const std::string& arg1, const std::string& arg2);
/// Replaces all occurrences of $<n> in fmt with the string given in arg<n> and /// Replaces all occurrences of $<n> in fmt with the string given in arg<n> and
/// returns the result. To include a dollar sign in the result string, /// returns the result. To include a dollar sign in the result string,
/// specify two dollar signs ($$) in the format string. /// specify two dollar signs ($$) in the format string.
static std::string format(const std::string& fmt, const std::string& arg0, const std::string& arg1, const std::string& arg2, const std::string& arg3); static std::string format(const std::string& fmt, const std::string& arg0, const std::string& arg1, const std::string& arg2, const std::string& arg3);
/// Replaces all occurrences of $<n> in fmt with the string given in arg<n> and /// Replaces all occurrences of $<n> in fmt with the string given in arg<n> and
/// returns the result. To include a dollar sign in the result string, /// returns the result. To include a dollar sign in the result string,
/// specify two dollar signs ($$) in the format string. /// specify two dollar signs ($$) in the format string.
@@ -372,11 +372,11 @@ public:
static void formatDump(std::string& message, const void* buffer, std::size_t length); static void formatDump(std::string& message, const void* buffer, std::size_t length);
/// Creates a hex-dump of the given buffer and appends it to the /// Creates a hex-dump of the given buffer and appends it to the
/// given message string. /// given message string.
static void setLevel(const std::string& name, int level); static void setLevel(const std::string& name, int level);
/// Sets the given log level on all loggers that are /// Sets the given log level on all loggers that are
/// descendants of the Logger with the given name. /// descendants of the Logger with the given name.
static void setChannel(const std::string& name, Channel::Ptr pChannel); static void setChannel(const std::string& name, Channel::Ptr pChannel);
/// Attaches the given Channel to all loggers that are /// Attaches the given Channel to all loggers that are
/// descendants of the Logger with the given name. /// descendants of the Logger with the given name.
@@ -399,35 +399,35 @@ public:
/// probably use get() instead. /// probably use get() instead.
/// The only time this method should be used is during /// The only time this method should be used is during
/// program initialization, when only one thread is running. /// program initialization, when only one thread is running.
static Logger& create(const std::string& name, Channel::Ptr pChannel, int level = Message::PRIO_INFORMATION); static Logger& create(const std::string& name, Channel::Ptr pChannel, int level = Message::PRIO_INFORMATION);
/// Creates and returns a reference to a Logger with the /// Creates and returns a reference to a Logger with the
/// given name. The Logger's Channel and log level as set as /// given name. The Logger's Channel and log level as set as
/// specified. /// specified.
static Logger& root(); static Logger& root();
/// Returns a reference to the root logger, which is the ultimate /// Returns a reference to the root logger, which is the ultimate
/// ancestor of all Loggers. /// ancestor of all Loggers.
static Ptr has(const std::string& name); static Ptr has(const std::string& name);
/// Returns a pointer to the Logger with the given name if it /// Returns a pointer to the Logger with the given name if it
/// exists, or a null pointer otherwise. /// exists, or a null pointer otherwise.
static void destroy(const std::string& name); static void destroy(const std::string& name);
/// Destroys the logger with the specified name. Does nothing /// Destroys the logger with the specified name. Does nothing
/// if the logger is not found. /// if the logger is not found.
/// ///
/// After a logger has been destroyed, all references to it /// After a logger has been destroyed, all references to it
/// become invalid. /// become invalid.
static void shutdown(); static void shutdown();
/// Shuts down the logging framework and releases all /// Shuts down the logging framework and releases all
/// Loggers. /// Loggers.
static void names(std::vector<std::string>& names); static void names(std::vector<std::string>& names);
/// Fills the given vector with the names /// Fills the given vector with the names
/// of all currently defined loggers. /// of all currently defined loggers.
static int parseLevel(const std::string& level); static int parseLevel(const std::string& level);
/// Parses a symbolic log level from a string and /// Parses a symbolic log level from a string and
/// returns the resulting numeric level. /// returns the resulting numeric level.
@@ -444,15 +444,15 @@ public:
/// - trace /// - trace
/// ///
/// The level is not case sensitive. /// The level is not case sensitive.
static const std::string ROOT; /// The name of the root logger (""). static const std::string ROOT; /// The name of the root logger ("").
protected: protected:
typedef std::map<std::string, Ptr> LoggerMap; typedef std::map<std::string, Ptr> LoggerMap;
Logger(const std::string& name, Channel::Ptr pChannel, int level); Logger(const std::string& name, Channel::Ptr pChannel, int level);
~Logger(); ~Logger();
void log(const std::string& text, Message::Priority prio); void log(const std::string& text, Message::Priority prio);
void log(const std::string& text, Message::Priority prio, const char* file, int line); void log(const std::string& text, Message::Priority prio, const char* file, int line);
@@ -467,7 +467,7 @@ private:
Logger(); Logger();
Logger(const Logger&); Logger(const Logger&);
Logger& operator = (const Logger&); Logger& operator = (const Logger&);
std::string _name; std::string _name;
Channel::Ptr _pChannel; Channel::Ptr _pChannel;
int _level; int _level;