[Reviewer: Ellie] Craft logging Enhanced Node Troubleshooting 

Added PDLog infrastructure (definition in new header, craft_dcea.h) and PDLogs for http and sip.
Syslog does not permit any formatting in the message string.  Any extra white spaces, newlines are stripped.

From: Eleanor Merry [mailto:notifications@github.com]
Sent: Friday, September 26, 2014 5:38 AM
To: Metaswitch/cpp-common
Cc: David Collins
Subject: Re: [cpp-common] [Reviewer: Ellie] Craft logging Enhanced Node Troubleshooting (#184)


In include/craft_dcea.h:

> +class PDLogBase

> +{

> + public:

> +  enum {

> +    MAX_ARG_SIZE=10,

> +    CL_CPP_COMMON_ID = 1000,

> +    CL_SPROUT_ID = 2000,

> +    CL_CHRONOS_ID = 3000,

> +    CL_HOMESTEAD_ID = 4000,

> +    CL_RALF_ID = 5000

> +};

> + PDLogBase(int log_id, int severity, const std::string& msg, const std::string& cause, const std::string& effect) : _log_id(log_id), _severity(severity), _msg(msg), _cause(cause), _effect(effect) {};

> +

> +  virtual void cealog() const

> +  {

> +    syslog(_severity,"%d - Cause: %s", _log_id, _cause.c_str());

Do you need to have multiple calls to syslog? This increases the chance that some of the messages can get lost or out of order. I think it's better to construct the message first, and then make a single syslog call.

—
Reply to this email directly or view it on GitHub<https://github.com/Metaswitch/cpp-common/pull/184/files#r18082960>.