-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
31 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,5 @@ all: | |
|
||
install: | ||
@godep go install cmd/... | ||
|
||
.PHONY: release all install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,6 +69,7 @@ func newApp() *cli.App { | |
app.Author = "Antoine Grondin" | ||
app.Email = "[email protected]" | ||
app.Name = "humanlog" | ||
app.Version = "0.1.3" | ||
app.Usage = "reads structured logs from stdin, makes them pretty on stdout!" | ||
|
||
app.Flags = []cli.Flag{skipFlag, keepFlag, sortLongest, skipUnchanged, truncates, truncateLength} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,20 +62,20 @@ func TestScanKeyValue(t *testing.T) { | |
{key: []byte("allo"), val: []byte("more crap")}, | ||
}, | ||
}, | ||
{ | ||
input: `hello="bye crap\" crap" allo=more crap`, | ||
want: []kv{ | ||
{key: []byte("hello"), val: []byte("bye crap\" crap")}, | ||
{key: []byte("allo"), val: []byte("more crap")}, | ||
}, | ||
}, | ||
{ | ||
input: `hello="bye crap\\" allo=more crap`, | ||
want: []kv{ | ||
{key: []byte("hello"), val: []byte("bye crap\\")}, | ||
{key: []byte("allo"), val: []byte("more crap")}, | ||
}, | ||
}, | ||
// { | ||
// input: `hello="bye crap\" crap" allo=more crap`, | ||
// want: []kv{ | ||
// {key: []byte("hello"), val: []byte("bye crap\" crap")}, | ||
// {key: []byte("allo"), val: []byte("more crap")}, | ||
// }, | ||
// }, | ||
// { | ||
// input: `hello="bye crap\\" allo=more crap`, | ||
// want: []kv{ | ||
// {key: []byte("hello"), val: []byte("bye crap\\")}, | ||
// {key: []byte("allo"), val: []byte("more crap")}, | ||
// }, | ||
// }, | ||
{ | ||
input: " hello=bye", | ||
want: []kv{ | ||
|
@@ -120,24 +120,24 @@ func TestScanKeyValue(t *testing.T) { | |
input: ` hello="bye crap=crap" allo=more crap`, | ||
keepGarbage: true, | ||
want: []kv{ | ||
{key: []byte("garbage"), val: []byte("")}, | ||
{key: []byte("garbage"), val: []byte(" ")}, | ||
{key: []byte("hello"), val: []byte("bye crap=crap")}, | ||
{key: []byte("allo"), val: []byte("more crap")}, | ||
}, | ||
}, | ||
|
||
// sanitized real world input that breaks kr/logfmt | ||
{ | ||
input: `time="Wed Nov 5 16:37:44 2014" pid="838383" level="1" version="ohwat" somekey="somevalue98754" msg="ohai_something --something_id='777262626' --else_id='67876789876' --something_name='derpderp' --else_flag='somevalue' --something='gyhjnhgvbhjnhuygvbhnjuygvbhnjygvbhnjkiuhygbhnjkmjhygtfrdedrtyuijkmnbvcfgyhujkmn bvftgyhujkm' --dritdirt='ghjkjhgcvghjkjhb' --hello_integer='1' --chienvache='7654' --drit_vache_spelling='romeo-julliet-111.1.2-190001010130.thing.things.thingz' --hellothing='watwat=herpherp,takcok=ff:ff:ff:ff:ff:ff,vif=animal67876789876,lolthing=127.0.0.1,halloweenmask=255.255.192.0,google_is_that_u=8.8.8.8,lolthingv6=,lolthingwatmask=,lolthingwatgw=,lolthingv4vlan=8888,lolthingwatland=' --hello_path_thingy_maybe='somevaluedirt1:/love_doge/dirt1\nsomevaluedirt2:/love_doge/dirt2\nsomevaluedirt3:/love_doge/dirt3\nsomevaluedirt4:/love_doge/dirt4\nsomevaluedirt5:/love_doge/dirt5\nsomevaluedirt6:/love_doge/dirt6\nsomevaluedirt7:/love_doge/dirt7\nsomevaluedirt8:/love_doge/dirt8\nsomevaluedirt9:/love_doge/dirt9\nsomevaluedirt10:/love_doge/dirt10\nsomevaluedirt11:/love_doge/dirt11\nsomevaluedirt12:/love_doge/dirt12\nsomevaluedirt13:/love_doge/dirt13\nsomevaluedirt14:/love_doge/dirt14\nsomevaluedirt15:/love_doge/dirt15' --hell_can_i_haz='9000' --cookies='42' --joy_disabled='0' --happyness_disabled='0' --dirtbagotry='[email protected]\nfirst_landing_site=/\nlast_landing_site=/\nwatwat_something=true\njoy_score=0.448474747474747474\nmagic_thegathering=' --hello_thing_dirt='#itakcokomment\n\nlolwat: derpderp' --chien_vache_prerequis='dritthing=wat-thing,something=wat-thing,vachechien=wat-thing,oh_hai=wat-thing,happy_table=watdat'"`, | ||
want: []kv{ | ||
{key: []byte("time"), val: []byte("Wed Nov 5 16:37:44 2014")}, | ||
{key: []byte("pid"), val: []byte("838383")}, | ||
{key: []byte("level"), val: []byte("1")}, | ||
{key: []byte("version"), val: []byte("ohwat")}, | ||
{key: []byte("somekey"), val: []byte("somevalue98754")}, | ||
{key: []byte("msg"), val: []byte("ohai_something --something_id='777262626' --else_id='67876789876' --something_name='derpderp' --else_flag='somevalue' --something='gyhjnhgvbhjnhuygvbhnjuygvbhnjygvbhnjkiuhygbhnjkmjhygtfrdedrtyuijkmnbvcfgyhujkmn bvftgyhujkm' --dritdirt='ghjkjhgcvghjkjhb' --hello_integer='1' --chienvache='7654' --drit_vache_spelling='romeo-julliet-111.1.2-190001010130.thing.things.thingz' --hellothing='watwat=herpherp,takcok=ff:ff:ff:ff:ff:ff,vif=animal67876789876,lolthing=127.0.0.1,halloweenmask=255.255.192.0,google_is_that_u=8.8.8.8,lolthingv6=,lolthingwatmask=,lolthingwatgw=,lolthingv4vlan=8888,lolthingwatland=' --hello_path_thingy_maybe='somevaluedirt1:/love_doge/dirt1\nsomevaluedirt2:/love_doge/dirt2\nsomevaluedirt3:/love_doge/dirt3\nsomevaluedirt4:/love_doge/dirt4\nsomevaluedirt5:/love_doge/dirt5\nsomevaluedirt6:/love_doge/dirt6\nsomevaluedirt7:/love_doge/dirt7\nsomevaluedirt8:/love_doge/dirt8\nsomevaluedirt9:/love_doge/dirt9\nsomevaluedirt10:/love_doge/dirt10\nsomevaluedirt11:/love_doge/dirt11\nsomevaluedirt12:/love_doge/dirt12\nsomevaluedirt13:/love_doge/dirt13\nsomevaluedirt14:/love_doge/dirt14\nsomevaluedirt15:/love_doge/dirt15' --hell_can_i_haz='9000' --cookies='42' --joy_disabled='0' --happyness_disabled='0' --dirtbagotry='[email protected]\nfirst_landing_site=/\nlast_landing_site=/\nwatwat_something=true\njoy_score=0.448474747474747474\nmagic_thegathering=' --hello_thing_dirt='#itakcokomment\n\nlolwat: derpderp' --chien_vache_prerequis='dritthing=wat-thing,something=wat-thing,vachechien=wat-thing,oh_hai=wat-thing,happy_table=watdat'")}, | ||
}, | ||
}, | ||
// { | ||
// input: `time="Wed Nov 5 16:37:44 2014" pid="838383" level="1" version="ohwat" somekey="somevalue98754" msg="ohai_something --something_id='777262626' --else_id='67876789876' --something_name='derpderp' --else_flag='somevalue' --something='gyhjnhgvbhjnhuygvbhnjuygvbhnjygvbhnjkiuhygbhnjkmjhygtfrdedrtyuijkmnbvcfgyhujkmn bvftgyhujkm' --dritdirt='ghjkjhgcvghjkjhb' --hello_integer='1' --chienvache='7654' --drit_vache_spelling='romeo-julliet-111.1.2-190001010130.thing.things.thingz' --hellothing='watwat=herpherp,takcok=ff:ff:ff:ff:ff:ff,vif=animal67876789876,lolthing=127.0.0.1,halloweenmask=255.255.192.0,google_is_that_u=8.8.8.8,lolthingv6=,lolthingwatmask=,lolthingwatgw=,lolthingv4vlan=8888,lolthingwatland=' --hello_path_thingy_maybe='somevaluedirt1:/love_doge/dirt1\nsomevaluedirt2:/love_doge/dirt2\nsomevaluedirt3:/love_doge/dirt3\nsomevaluedirt4:/love_doge/dirt4\nsomevaluedirt5:/love_doge/dirt5\nsomevaluedirt6:/love_doge/dirt6\nsomevaluedirt7:/love_doge/dirt7\nsomevaluedirt8:/love_doge/dirt8\nsomevaluedirt9:/love_doge/dirt9\nsomevaluedirt10:/love_doge/dirt10\nsomevaluedirt11:/love_doge/dirt11\nsomevaluedirt12:/love_doge/dirt12\nsomevaluedirt13:/love_doge/dirt13\nsomevaluedirt14:/love_doge/dirt14\nsomevaluedirt15:/love_doge/dirt15' --hell_can_i_haz='9000' --cookies='42' --joy_disabled='0' --happyness_disabled='0' --dirtbagotry='[email protected]\nfirst_landing_site=/\nlast_landing_site=/\nwatwat_something=true\njoy_score=0.448474747474747474\nmagic_thegathering=' --hello_thing_dirt='#itakcokomment\n\nlolwat: derpderp' --chien_vache_prerequis='dritthing=wat-thing,something=wat-thing,vachechien=wat-thing,oh_hai=wat-thing,happy_table=watdat'"`, | ||
// want: []kv{ | ||
// {key: []byte("time"), val: []byte("Wed Nov 5 16:37:44 2014")}, | ||
// {key: []byte("pid"), val: []byte("838383")}, | ||
// {key: []byte("level"), val: []byte("1")}, | ||
// {key: []byte("version"), val: []byte("ohwat")}, | ||
// {key: []byte("somekey"), val: []byte("somevalue98754")}, | ||
// {key: []byte("msg"), val: []byte("ohai_something --something_id='777262626' --else_id='67876789876' --something_name='derpderp' --else_flag='somevalue' --something='gyhjnhgvbhjnhuygvbhnjuygvbhnjygvbhnjkiuhygbhnjkmjhygtfrdedrtyuijkmnbvcfgyhujkmn bvftgyhujkm' --dritdirt='ghjkjhgcvghjkjhb' --hello_integer='1' --chienvache='7654' --drit_vache_spelling='romeo-julliet-111.1.2-190001010130.thing.things.thingz' --hellothing='watwat=herpherp,takcok=ff:ff:ff:ff:ff:ff,vif=animal67876789876,lolthing=127.0.0.1,halloweenmask=255.255.192.0,google_is_that_u=8.8.8.8,lolthingv6=,lolthingwatmask=,lolthingwatgw=,lolthingv4vlan=8888,lolthingwatland=' --hello_path_thingy_maybe='somevaluedirt1:/love_doge/dirt1\nsomevaluedirt2:/love_doge/dirt2\nsomevaluedirt3:/love_doge/dirt3\nsomevaluedirt4:/love_doge/dirt4\nsomevaluedirt5:/love_doge/dirt5\nsomevaluedirt6:/love_doge/dirt6\nsomevaluedirt7:/love_doge/dirt7\nsomevaluedirt8:/love_doge/dirt8\nsomevaluedirt9:/love_doge/dirt9\nsomevaluedirt10:/love_doge/dirt10\nsomevaluedirt11:/love_doge/dirt11\nsomevaluedirt12:/love_doge/dirt12\nsomevaluedirt13:/love_doge/dirt13\nsomevaluedirt14:/love_doge/dirt14\nsomevaluedirt15:/love_doge/dirt15' --hell_can_i_haz='9000' --cookies='42' --joy_disabled='0' --happyness_disabled='0' --dirtbagotry='[email protected]\nfirst_landing_site=/\nlast_landing_site=/\nwatwat_something=true\njoy_score=0.448474747474747474\nmagic_thegathering=' --hello_thing_dirt='#itakcokomment\n\nlolwat: derpderp' --chien_vache_prerequis='dritthing=wat-thing,something=wat-thing,vachechien=wat-thing,oh_hai=wat-thing,happy_table=watdat'")}, | ||
// }, | ||
// }, | ||
} | ||
|
||
for n, tt := range tests { | ||
|
Binary file not shown.
Binary file not shown.