arriven / db1000n

MIT License
1.17k stars 201 forks source link

Add a new flag `-log-format` and a `simple` format #517

Closed roman-kruglov closed 2 years ago

roman-kruglov commented 2 years ago

the most human readable format for those who only look at the output in a terminal

Description

With the recent switch to zap as the used logger it became much harder to just look at terminal's output. If you just run it manually and the output is for reading rather than logging, using -log-format simple makes the output much more bearable.

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

By running and looking at the output in a terminal.

Test Configuration

Logs

Output sample (real values crossed out)

db1000n % ./db1000n -log-format simple
running db1000n {"version": "v0.8.30", "pid": 84370}
checking IP address,    {"iter": 1}
error fetching location info    {"error": "Get \"https://sample/\": context deadline exceeded"}
checking IP address,    {"iter": 2}
location info   {"country": "Some country", "ip": "XX.XX.XX.XX"}
loading config  {"path": "sample"}
new config received, applying
attacking       {"target": "http://sample"}
attacking       {"target": "http://sample"}
attacking       {"target": "http://sample"}
error running job       {"name": "", "type": "encrypted", "error": "encryption not supported"}
job instances (re)started       {"count": 874}
attacking       {"target": "https://sample/sample"}
single http request     {"target": "https://sample/"}
roman-kruglov commented 2 years ago

I would maybe even go ahead and make it the default format in next release

yeah, exactly, I was thinking the same thing, but thought it would be too much to ask for this with my first pr :) I'll make it happen, have several more ideas how to improve it even more