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

Use rust logging API #5525

Merged
merged 2 commits into from
Feb 28, 2018
Merged

Conversation

illicitonion
Copy link
Contributor

This allows non-engine crates (and the external libraries we use) to log.

When in the engine, this passes messages up to python to log.

When in a standalone binary, this registers an env_logger.

Examples:

$ RUST_LOG=debug ./target/debug/process_executor --server=localhost:50000 --cas-server=localhost:50001 --local-store-path=${HOME}/tmp/store --input-digest=6f9a33e23a007c58c1e83f29bcf52979c797aba200cec0058695ff72d181e6ed --input-digest-length=85 -- /bin/bash -c "exit 42"
DEBUG 2018-02-27T15:23:19Z: process_execution::remote: Executing remotely request: action {command_digest {hash: "8a1eb3dc8694551ee161e6f616de205f7c2d5b52c8f5b93d2745d67c3b750e6a" size_bytes: 24} input_root_digest {hash: "6f9a33e23a007c58c1e83f29bcf52979c797aba200cec0058695ff72d181e6ed" size_bytes: 85}} (command: arguments: "/bin/bash" arguments: "-c" arguments: "exit 42")
DEBUG 2018-02-27T15:23:20Z: process_execution::remote: Got operation response: name: "b15e0908-7956-4dfa-7fc7-48dffc8aff8d" metadata {type_url: "type.googleapis.com/google.devtools.remoteexecution.v1test.ExecuteOperationMetadata" value: "\010\002\022E\n@81d6ae5c2323235c8633ffa63a1867bcc40306e0da9012a3d387df2eead80e3d\020\214\001"} response {type_url: "type.googleapis.com/google.devtools.remoteexecution.v1test.ExecuteResponse"}
$ ./pants -ldebug clean-all >/dev/null 2>/dev/null ; ./pants -ldebug list 3rdparty:: 2>&1 | grep Launching
DEBUG] Launching 2 roots.
DEBUG] Launching 1 roots.
DEBUG] Launching 2 roots.

When in the engine, this passes messages up to python to log.

When in a standalone binary, this registers an env_logger.

Examples:

```
$ RUST_LOG=debug ./target/debug/process_executor --server=localhost:50000 --cas-server=localhost:50001 --local-store-path=${HOME}/tmp/store --input-digest=6f9a33e23a007c58c1e83f29bcf52979c797aba200cec0058695ff72d181e6ed --input-digest-length=85 -- /bin/bash -c "exit 42"
DEBUG 2018-02-27T15:23:19Z: process_execution::remote: Executing remotely request: action {command_digest {hash: "8a1eb3dc8694551ee161e6f616de205f7c2d5b52c8f5b93d2745d67c3b750e6a" size_bytes: 24} input_root_digest {hash: "6f9a33e23a007c58c1e83f29bcf52979c797aba200cec0058695ff72d181e6ed" size_bytes: 85}} (command: arguments: "/bin/bash" arguments: "-c" arguments: "exit 42")
DEBUG 2018-02-27T15:23:20Z: process_execution::remote: Got operation response: name: "b15e0908-7956-4dfa-7fc7-48dffc8aff8d" metadata {type_url: "type.googleapis.com/google.devtools.remoteexecution.v1test.ExecuteOperationMetadata" value: "\010\002\022E\n@81d6ae5c2323235c8633ffa63a1867bcc40306e0da9012a3d387df2eead80e3d\020\214\001"} response {type_url: "type.googleapis.com/google.devtools.remoteexecution.v1test.ExecuteResponse"}
```

```
$ ./pants -ldebug clean-all >/dev/null 2>/dev/null ; ./pants -ldebug list 3rdparty:: 2>&1 | grep Launching
DEBUG] Launching 2 roots.
DEBUG] Launching 1 roots.
DEBUG] Launching 2 roots.
```
Copy link
Member

@stuhood stuhood left a comment

Choose a reason for hiding this comment

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

Thanks!

@@ -500,3 +487,65 @@ where
mem::forget(cs);
output
}


Copy link
Member

Choose a reason for hiding this comment

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

some spare lines here.


impl log::Log for FfiLogger {
fn enabled(&self, _metadata: &log::Metadata) -> bool {
// TODO: Inspect the current log setting from the python and actually filter.
Copy link
Member

Choose a reason for hiding this comment

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

I would expect that the debug! macro (which you are using) delegates to this at some level to implement laziness?

But I agree that it's not a high priority yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

enabled is actually only used by the log_enabled! macro - the individual logging macros don't call this at all, which is why log calls self.enabled :)

@illicitonion illicitonion merged commit 1150d09 into pantsbuild:master Feb 28, 2018
illicitonion added a commit to twitter/pants that referenced this pull request Mar 5, 2018
wisechengyi pushed a commit that referenced this pull request Mar 5, 2018
wisechengyi pushed a commit that referenced this pull request Mar 5, 2018
* Revert "Use rust logging API (#5525)"

This reverts commit 1150d09.

* Revert "Fix up remote process execution (#5500)"

This reverts commit 628c83d.

* Revert "Remote execution uploads files from a Store (#5499)"

This reverts commit 935086b.

* Revert "Remote command execution returns a Future (#5497)"

This reverts commit fbff143.

* Revert "Snapshot is backed by LMDB not tar files (#5496)"

This reverts commit e3c38ba.
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.

2 participants