aws / aws/aws-lambda-runtime-interface-emulator
logs not showing correctly when using sam
- Ngôn ngữ chính
- Go
- Star
- 1.1k
- Fork
- 118
- Merge trung bình
- 42 phút
- Pull request đã merge (30 ngày)
- 2
Mô tả
**Description**
When using sam invoke, the output of `console.log` is not displayed correctly as described in [this issue](https://github.com/aws/aws-sam-cli/issues/1359).
**Steps to reproduce**
`console.log('line one\rline two\rline three\nline four\nline five')`
will output
> START RequestId: ac1ef293-d504-16a9-6b21-20a04c7f98e6 Version: $LATEST
> line fiveeT14:12:51.527Z ac1ef293-d504-16a9-6b21-20a04c7f98e6 INFO line one
> END RequestId: ac1ef293-d504-16a9-6b21-20a04c7f98e6
and
`console.log(json.stringify({one: 'line one', two: 'line two', three: 'line three', four: 'line four'}, null, 2))`
is just as problematic. One can only read the first and last lines, usually `{` and` }`
According to @mhart
> This is due to some unfortunate internal changes in the runtimes where console.log is overwritten by a function that transforms all newlines to \r.
**Additional environment details**
os: OSX 10.14.6
sam cli versions tested: 1.3.0, 1.12.0, 1.13.2
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện đầu ra nhiều dòng của console.log bằng sam invoke, sử dụng các ví dụ trong issue, sau đó theo dõi cách trình giả lập giao diện runtime xử lý đầu ra của console và các ký tự xuống dòng. Hoàn thành khi các ký tự carriage return và các log nhiều dòng, bao gồm cả JSON được pretty-print, được hiển thị chính xác.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript
- Lĩnh vực
- backend
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100