Expanded support for modifying the timestamp format in the JSON formatter.

This commit is contained in:
Seth Hall 2014-03-12 10:01:59 -04:00
parent 6cd9358a71
commit c591e4f57f
8 changed files with 69 additions and 19 deletions

View file

@ -13,7 +13,14 @@ namespace threading { namespace formatter {
*/
class JSON : public Formatter {
public:
JSON(threading::MsgThread* t, bool json_iso_timestamps);
enum TimeFormat {
TS_EPOCH, // Doubles that represents seconds from the UNIX epoch.
TS_ISO8601, // ISO 8601 defined human readable timestamp format.
TS_MILLIS // Milliseconds from the UNIX epoch. Some things need this (elasticsearch).
};
JSON(threading::MsgThread* t, TimeFormat tf);
virtual ~JSON();
virtual bool Describe(ODesc* desc, threading::Value* val) const;
@ -23,7 +30,7 @@ public:
virtual threading::Value* ParseValue(string s, string name, TypeTag type, TypeTag subtype = TYPE_ERROR) const;
private:
bool iso_timestamps;
TimeFormat timestamps;
};
}}