diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7c7c99e7..5ab309a5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -190,6 +190,10 @@ set(diag_STAT_SRCS set(lnav_SRCS lnav.cc) -include_directories(../../lbuild-debug/src /opt/local/include) +include_directories( + ../../lbuild-debug/src + /opt/local/include + /usr/local/opt/sqlite3/include +) include_directories(SYSTEM .) add_executable(lnav ${lnav_SRCS} ${diag_STAT_SRCS}) diff --git a/src/json_ptr.cc b/src/json_ptr.cc index 40ad4c08..caf35673 100644 --- a/src/json_ptr.cc +++ b/src/json_ptr.cc @@ -187,12 +187,16 @@ json_ptr::encode(char *dst, size_t dst_len, const char *src, size_t src_len) switch (src[lpc]) { case '/': case '~': + case '#': if (retval < dst_len) { dst[retval] = '~'; retval += 1; if (src[lpc] == '~') { dst[retval] = '0'; } + else if (src[lpc] == '#') { + dst[retval] = '2'; + } else { dst[retval] = '1'; } @@ -234,6 +238,10 @@ size_t json_ptr::decode(char *dst, const char *src, ssize_t src_len) dst[retval++] = '/'; lpc += 1; break; + case '2': + dst[retval++] = '#'; + lpc += 1; + break; default: break; } diff --git a/src/yajlpp.cc b/src/yajlpp.cc index 6e6338ae..82450d1f 100644 --- a/src/yajlpp.cc +++ b/src/yajlpp.cc @@ -208,6 +208,10 @@ int yajlpp_parse_context::map_key(void *ctx, ypc->ypc_path.push_back('~'); ypc->ypc_path.push_back('1'); break; + case '#': + ypc->ypc_path.push_back('~'); + ypc->ypc_path.push_back('2'); + break; default: ypc->ypc_path.push_back(key[lpc]); break; diff --git a/test/formats/nestedjson/format.json b/test/formats/nestedjson/format.json index 601a9421..e6916f4c 100644 --- a/test/formats/nestedjson/format.json +++ b/test/formats/nestedjson/format.json @@ -18,6 +18,9 @@ "@fields/user" : { "kind" : "string", "identifier" : true + }, + "@fields/trace#" : { + "kind" : "string" } } } diff --git a/test/logfile_nested_json.json b/test/logfile_nested_json.json index 905d215a..6cc80726 100644 --- a/test/logfile_nested_json.json +++ b/test/logfile_nested_json.json @@ -10,4 +10,4 @@ {"ts": "2013-09-06T22:01:49.124817Z", "@fields": { "lvl": "WARNING", "msg": "not looking good"}} {"ts": "2013-09-06T22:01:49.124817Z", "@fields": { "lvl": "ERROR", "msg": "looking bad"}} {"ts": "2013-09-06T22:01:49.124817Z", "@fields": { "lvl": "CRITICAL", "msg": "sooo bad"}} -{"ts": "2013-09-06T22:01:49.124817Z", "@fields": { "lvl": "FATAL", "msg": "shoot"}} +{"ts": "2013-09-06T22:01:49.124817Z", "@fields": { "lvl": "FATAL", "msg": "shoot", "trace": ["line:1", "line:2"]}} diff --git a/test/test_json_format.sh b/test/test_json_format.sh index 772a5de2..f5cca7c5 100644 --- a/test/test_json_format.sh +++ b/test/test_json_format.sh @@ -445,7 +445,9 @@ check_output "json log format is not working" <,2013-09-06 20:00:48.124,0,trace,0,,,[], -2,,2013-09-06 20:00:49.124,1000,info,0,,,[], -4,,2013-09-06 22:00:49.124,7200000,info,0,,,[],steve@example.com -7,,2013-09-06 22:00:59.124,10000,debug5,0,,,[], -9,,2013-09-06 22:00:59.124,0,debug4,0,,,[], -11,,2013-09-06 22:00:59.124,0,debug3,0,,,[], -13,,2013-09-06 22:00:59.124,0,debug2,0,,,[], -15,,2013-09-06 22:00:59.124,0,debug,0,,,[], -17,,2013-09-06 22:01:49.124,50000,stats,0,,,[], -19,,2013-09-06 22:01:49.124,0,warning,0,,,[], -21,,2013-09-06 22:01:49.124,0,error,0,,,[], -23,,2013-09-06 22:01:49.124,0,critical,0,,,[], -25,,2013-09-06 22:01:49.124,0,fatal,0,,,[], +log_line,log_part,log_time,log_idle_msecs,log_level,log_mark,log_comment,log_tags,log_filters,@fields/trace#,@fields/user +0,,2013-09-06 20:00:48.124,0,trace,0,,,[],, +2,,2013-09-06 20:00:49.124,1000,info,0,,,[],, +4,,2013-09-06 22:00:49.124,7200000,info,0,,,[],,steve@example.com +7,,2013-09-06 22:00:59.124,10000,debug5,0,,,[],, +9,,2013-09-06 22:00:59.124,0,debug4,0,,,[],, +11,,2013-09-06 22:00:59.124,0,debug3,0,,,[],, +13,,2013-09-06 22:00:59.124,0,debug2,0,,,[],, +15,,2013-09-06 22:00:59.124,0,debug,0,,,[],, +17,,2013-09-06 22:01:49.124,50000,stats,0,,,[],, +19,,2013-09-06 22:01:49.124,0,warning,0,,,[],, +21,,2013-09-06 22:01:49.124,0,error,0,,,[],, +23,,2013-09-06 22:01:49.124,0,critical,0,,,[],, +25,,2013-09-06 22:01:49.124,0,fatal,0,,,[],line:1, EOF