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

Strip ANSI colors (and other escapes?) from log messages #1

Open
dmolesUC opened this issue Aug 23, 2021 · 2 comments
Open

Strip ANSI colors (and other escapes?) from log messages #1

dmolesUC opened this issue Aug 23, 2021 · 2 comments

Comments

@dmolesUC
Copy link
Contributor

E.g. this noise:

{
  "msg": " \u001b[1m\u001b[36mLendingItem Exists? (1.6ms)\u001b[0m \u001b[1m\u001b[34mSELECT 1 AS one FROM \"lending_items\" WHERE \"lending_items\".\"directory\" = $1 LIMIT $2\u001b[0m [[\"directory\", \"b100523250_C044235662\"], [\"LIMIT\", 1]]"
}
@dmolesUC
Copy link
Contributor Author

dmolesUC commented Sep 2, 2021

Fixed in f2c9267.

@dmolesUC dmolesUC closed this as completed Sep 2, 2021
@dmolesUC
Copy link
Contributor Author

dmolesUC commented Sep 2, 2021

Fix doesn't seem to be sufficient to stop ActiveRecord from including color noise:

{
  "name": "rails",
  "hostname": "Anachronic.local",
  "pid": 42718,
  "level": 20,
  "time": "2021-09-02T12:56:00.962-07:00",
  "v": 0,
  "severity": "DEBUG",
  "msg": "  \u001b[35m (1.9ms)  \u001b[34mSELECT COUNT(\"lending_item_loans\".\"lending_item_id\") AS count_lending_item_id, \"lending_item_loans\".\"lending_item_id\" AS lending_item_loans_lending_item_id FROM \"lending_item_loans\" INNER JOIN \"lending_items\" ON \"lending_items\".\"id\" = \"lending_item_loans\".\"lending_item_id\" WHERE \"lending_item_loans\".\"loan_status\" = $1 GROUP BY \"lending_item_loans\".\"lending_item_id\"  [[\"loan_status\", \"active\"]]"
}

Probably we need to investigate more what's actually coming through in a Rails context — e.g. is it already escaped by the time we try to decolorize it?

@dmolesUC dmolesUC reopened this Sep 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant