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

Logcat fixes #250

Merged
merged 3 commits into from
Aug 4, 2023
Merged

Logcat fixes #250

merged 3 commits into from
Aug 4, 2023

Conversation

amokfa
Copy link
Collaborator

@amokfa amokfa commented Jun 22, 2023

Closes #

Changes

  • Remove duplicate timestamps in logcat

  • Handle encoding errors properly in logcat output

@tekjar Doesn't include debugging changes in react-stability

Why?

Trials Performed

@@ -133,14 +134,18 @@ impl LogEntry {
}

pub fn to_payload(&self, sequence: u32) -> anyhow::Result<Payload> {
let payload = serde_json::to_value(self)?;

Ok(Payload {
stream: "logs".to_string(),
device_id: None,
sequence,
timestamp: self.timestamp,
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be log's timestamp if available

Copy link
Contributor

Choose a reason for hiding this comment

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

If logs are expected to have timestamps, can we treat timestamp errors as failures?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We only read real time logcat output so the two timestamps will always be very close.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Logcat line regex specifies time field as mandatory so if timestamp isn't there the regex match will fail.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Flush timeouts are working for logs stream now so the logs issue reactlabs saw shouldn't happen.


fn read_line_lossy(reader: &mut BufReader<ChildStdout>) -> Option<String> {
let mut buf = Vec::with_capacity(256);
if let Err(_) = reader.read_until(u8::try_from('\n').unwrap(), &mut buf) {
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Change to reader.read_until(b'\n', &mut buf)?
  2. Change Option to Result and break with error log

@de-sh de-sh merged commit 695960d into main Aug 4, 2023
2 checks passed
@de-sh de-sh deleted the uplink_android branch August 4, 2023 12:51
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

Successfully merging this pull request may close these issues.

3 participants