This action will force synchronization from 百度开源/incubator-Teaclave, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
permalink |
---|
/docs/development-tips |
The most common question on developing Teaclave is how to use Rust IDEs to improve the development experience, e.g., code completions, type hints and cross references. Internally, these features are supported by either RLS or rust-analyzer. Unfortunately, these features are not supported in Teaclave's codebase out-of-box. The reason is that Teaclave has components targeting different environments (SGX enclave and Linux app) which need different set of dependencies (SGX crates and vanilla crates). To support this flexible building and linking process, we are using cmake for our build system. However, there are still ways to workaround and let the analyzer understand the project structures.
When developing SGX enclaves and corresponding dependent crates, you need to
prepare a Cargo.toml
in the root directory to help the analyzer. This
Cargo.toml
file can be copied from our build system:
cmake/tomls/Cargo.sgx_trusted_lib.toml
. Similarly, when developing the app
parts, you can copy the cmake/tomls/Cargo.sgx_untrusted_lib.toml
file to the
root directory as Cargo.toml
. For standalone Rust applications such as CLI, no
Cargo.toml
is needed. After the preparation of Cargo.toml
in root,
RLS/rust-analyzer can understand the projects finally. You will see type hints
and cross references using IDEs with extensions.
Teaclave utilizes the env_logger
crate to configure the display of debug logs via environment variables.
Logging is controlled via the TEACLAVE_LOG
environment variables and the value
of this variable is a comma-separated list of logging directives in the
parth::to::module=level
form. For example, you can set the environment
TEACLAVE_LOG=attestation=debug
before launching a service to print the debug
level (and higher-level) logs in the attestation
module to stdout/stderr.
There are five logging levels: error
, warn
, info
, debug
and trace
where error represents the highest-priority log level. Furthermore, you can also
filter the results with regular expression by simply put /
followed by a regex
in the directives in the environment variable. You can find more filter usages
in the env_logger
's
document.
::: tip NOTE
To prevent sensitive information leakage through logging, for the release build,
we disable all logging (at build time) lower than the info
level. That is,
only error
, warn
and info
logs will be printed.
:::
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。