Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example of how to enable advanced logging for toolbox (DNR) #903

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Binary file added .toolbox.log.swp
Binary file not shown.
17 changes: 17 additions & 0 deletions .trunk/config/log4rs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
appenders:
stdout:
encoder:
pattern: "{d(%H:%M:%S)} | {({l}):5.5} | {f}:{L} | {m}{n}"
kind: console

file:
kind: file
path: { REPLACE_THIS_WITH_PATH_WHERE_YOU_WANT_LOGFILE }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be an absolute path to where you want the log to be written to.

encoder:
pattern: "{d(%H:%M:%S)} | {({l}):5.5} | {f}:{L} | {m}{n}"

root:
level: trace
appenders:
- stdout
- file
18 changes: 18 additions & 0 deletions .trunk/config/toolbox.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[ifchange]
# Default value: true
#enabled = true

[donotland]
# Default value: true
#enabled = true

[todo]
# Default value: false
#enabled = true

[neveredit]
# Default value: false
#enabled = true

# Default value: []
#paths = []
2 changes: 1 addition & 1 deletion .trunk/trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ lint:
# enabled linters inherited from github.com/trunk-io/configs plugin
- definition-checker
- [email protected]
- trunk-toolbox@0.4.1
- trunk-toolbox@0.5.0
disabled:
- pylint # pylint diagnostics are too strict
- semgrep
Expand Down
7 changes: 5 additions & 2 deletions linters/trunk-toolbox/plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 0.1

downloads:
- name: trunk-toolbox
version: 0.4.1
version: 0.5.0
downloads:
- os:
linux: unknown-linux-gnu
Expand All @@ -17,7 +17,7 @@ tools:
- name: trunk-toolbox
download: trunk-toolbox
shims: [trunk-toolbox]
known_good_version: 0.4.1
known_good_version: 0.5.0
lint:
definitions:
- name: trunk-toolbox
Expand All @@ -33,7 +33,10 @@ lint:
output: sarif
batch: true
success_codes: [0]
disable_upstream: false
read_output_from: tmp_file
direct_configs: [toolbox.toml, log4rs.yaml]
max_concurrency: 1
- name: lint
run: trunk-toolbox --upstream=${upstream-ref} --results=${tmpfile} ${target}
output: sarif
Expand Down
32 changes: 32 additions & 0 deletions toolbox.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
23:23:49 | DEBUG | src/main.rs:206 | logging initialized - "/tmp/trunk-1000/HmuGi9/log4rs.yaml"
23:23:49 | DEBUG | src/rules/pls_no_land.rs:46 | scanning 1 files for pls_no_land
23:23:49 | DEBUG | src/rules/if_change_then_change.rs:125 | scanning 1 files for if_change_then_change
23:23:49 | TRACE | src/rules/if_change_then_change.rs:55 | scanning contents of .trunk/trunk.yaml
23:23:49 | TRACE | src/rules/pls_no_land.rs:84 | scanning contents of .trunk/trunk.yaml
23:23:49 | TRACE | src/rules/never_edit.rs:28 | 'neveredit' is disabled
23:23:49 | DEBUG | src/main.rs:206 | logging initialized - "/tmp/trunk-1000/yoWHZd/log4rs.yaml"
23:23:49 | DEBUG | src/rules/pls_no_land.rs:46 | scanning 1 files for pls_no_land
23:23:49 | DEBUG | src/rules/if_change_then_change.rs:125 | scanning 1 files for if_change_then_change
23:23:49 | TRACE | src/rules/if_change_then_change.rs:55 | scanning contents of .trunk/trunk.yaml
23:23:49 | TRACE | src/rules/pls_no_land.rs:84 | scanning contents of .trunk/trunk.yaml
23:23:49 | TRACE | src/rules/never_edit.rs:28 | 'neveredit' is disabled
23:23:52 | DEBUG | src/main.rs:206 | logging initialized - "/tmp/trunk-1000/W0M4x6/log4rs.yaml"
23:23:52 | DEBUG | src/rules/pls_no_land.rs:46 | scanning 4 files for pls_no_land
23:23:52 | DEBUG | src/rules/if_change_then_change.rs:125 | scanning 4 files for if_change_then_change
23:23:52 | DEBUG | src/rules/pls_no_land.rs:70 | ignoring ignored file .trunk/config/toolbox.toml
23:23:52 | TRACE | src/rules/pls_no_land.rs:84 | scanning contents of .trunk/trunk.yaml
23:23:52 | TRACE | src/rules/pls_no_land.rs:84 | scanning contents of .trunk/config/log4rs.yaml
23:23:52 | TRACE | src/rules/pls_no_land.rs:84 | scanning contents of linters/trunk-toolbox/plugin.yaml
23:23:52 | TRACE | src/rules/if_change_then_change.rs:55 | scanning contents of .trunk/config/log4rs.yaml
23:23:52 | TRACE | src/rules/if_change_then_change.rs:55 | scanning contents of .trunk/config/toolbox.toml
23:23:52 | TRACE | src/rules/if_change_then_change.rs:55 | scanning contents of linters/trunk-toolbox/plugin.yaml
23:23:52 | TRACE | src/rules/if_change_then_change.rs:55 | scanning contents of .trunk/trunk.yaml
23:23:52 | TRACE | src/rules/never_edit.rs:28 | 'neveredit' is disabled
23:23:52 | DEBUG | src/main.rs:206 | logging initialized - "/tmp/trunk-1000/37ahSo/log4rs.yaml"
23:23:52 | DEBUG | src/rules/pls_no_land.rs:46 | scanning 2 files for pls_no_land
23:23:52 | DEBUG | src/rules/if_change_then_change.rs:125 | scanning 2 files for if_change_then_change
23:23:52 | TRACE | src/rules/pls_no_land.rs:84 | scanning contents of .trunk/trunk.yaml
23:23:52 | TRACE | src/rules/pls_no_land.rs:84 | scanning contents of linters/trunk-toolbox/plugin.yaml
23:23:52 | TRACE | src/rules/if_change_then_change.rs:55 | scanning contents of linters/trunk-toolbox/plugin.yaml
23:23:52 | TRACE | src/rules/if_change_then_change.rs:55 | scanning contents of .trunk/trunk.yaml
23:23:52 | TRACE | src/rules/never_edit.rs:28 | 'neveredit' is disabled
Loading