/**
+* Escape shell arguments.
+* @param input The input to escape.
+* @return The escaped string ready to use for the shell.
+*/
+string Logger::escape_shellarg(const string &input)
+{
+ string output = "'";
+ string::const_iterator it, it_end = input.end();
+ for (it = input.begin(); it != it_end; it++)
+ {
+ if ( (*it) == '\'')
+ output += "'\\'";
+
+ output += *it;
+ }
+
+ output += "'";
+ return output;
+}
+
+
+/**
* Decides if Logging through syslog if enabled or through std.
* @param msg The message to log.
*/
if (!message.empty() && message[message.length()-1] == '\n')
message.erase(message.length()-1); /*lint !e534 */
+ message = escape_shellarg(message);
+
string external = ExternalWarningLog;
external.append(" ");
external.append("\"");
void clear_external_send_messages();
+ std::string escape_shellarg(const std::string &input);
+
void log_notice(const std::string& msg) const;
void log_warning(const std::string& msg, int loglevel);