clasp icon indicating copy to clipboard operation
clasp copied to clipboard

`clasp logs --watch --simplifed` returns log with timestamp

Open leeyspaul opened this issue 5 years ago • 3 comments

It's highly possible that I am doing something wrong. But I'm receiving the timestamps when passing in both flags of --watch and --simplified.

I am not sure if this is the behavior that was intended.

Thank you!

Expected Behavior

$ clasp logs --watch --simplified
DEBUG      N/A {"message":"hello there!","serviceContext":{"service":"..."}}

Actual Behavior

$ clasp logs --watch --simplified
timestamp >= "2020-07-17T02:44:40.069Z"
timestamp >= "2020-07-17T02:44:46.071Z"
DEBUG      N/A {"message":"hello there!","serviceContext":{"service":"..."}}
timestamp >= "2020-07-17T02:44:46.071Z"

Specifications

  • Node version (node -v): v10.10.0
  • Version (clasp -v): 2.3.0
  • OS (Mac/Linux/Windows): Mac

leeyspaul avatar Jul 17 '20 02:07 leeyspaul

After doing some cursory git-blaming from within Github, I believe this issue was introduced by https://github.com/google/clasp/pull/778, though, I may be incorrect.

guywithacube avatar Jan 20 '21 11:01 guywithacube

This issue cause is likely here:

https://github.com/google/clasp/blob/ee70a6ae743d3b28b27b2c5cc6ca3e70c64f465b/src/commands/logs.ts#L212-L215

These lines are run every time ˋfetchAndPrintLogsˋ is invoked.

That part of the code would need some revision so that under ˋwatchˋ option it only displays once.

Anyone wants to draft a PR?

PopGoesTheWza avatar Mar 07 '21 11:03 PopGoesTheWza

@leeyspaul Just to be sure the issue still exist, can you try replacing @google/clasp 2.3.0 with forked-clasp which is more advanced?

npm uninstall -g @google/clasp
npm install -g forked-clasp

PopGoesTheWza avatar Mar 16 '21 23:03 PopGoesTheWza