Page MenuHomePhabricator

[Chronik] Add \n to logs in error.rs
ClosedPublic

Authored by tobias_ruck on Apr 3 2023, 13:46.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCad3228289f0b: [Chronik] Add \n to logs in error.rs
Summary

These look messy in debug.log when they occur because of the missing \n at the end.

For example, test plan on master would result in [chronik/chronik-http/src/error.rs:39] [<chronik unknown>] helloChronik HTTP server got an unknown error: helloReceived a POST request for
(cringe).

Now the log looks like this (based):

2023-04-03T13:40:31.058558Z (mocktime: 2012-04-02T02:22:17Z) [chronik/chronik-http/src/error.rs:39] [<chronik unknown>] hello
2023-04-03T13:40:31.058609Z (mocktime: 2012-04-02T02:22:17Z) [chronik/chronik-http/src/error.rs:40] [<chronik unknown>] Chronik HTTP server got an unknown error: hello
2023-04-03T13:40:31.116991Z (mocktime: 2012-04-02T02:22:17Z) [src/httpserver.cpp:252] [http_request_cb] Received a POST request for / from 127.0.0.1:62544
Test Plan
  1. Add abc_rust_error::bail!("hello") as first line in QueryTxs::tx_by_id
  2. ninja
  3. run chronik_tx functional test (-> fails)
  4. logs log multiple lines now

Diff Detail

Repository
rABC Bitcoin ABC
Branch
master
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 22913
Build 45446: Build Diffbuild-chronik
Build 45445: arc lint + arc unit

Event Timeline

Fabien requested changes to this revision.Apr 3 2023, 15:58

That's the wrong changes

This revision now requires changes to proceed.Apr 3 2023, 15:58

We should extend the log linter to catch these

This revision is now accepted and ready to land.Apr 4 2023, 08:07
This revision was automatically updated to reflect the committed changes.