Migrate from log to tracing crate for unified logging
#1122
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hyperlight was using both
logandtracingcrates inconsistently. This consolidates ontracingfor the host runtime while maintaininglogcompatibility for guest environments.Changes
Host Runtime
log::macros withtracing::equivalents throughout host codelog_then_return!anddebug!macros to usetracing::error!andtracing::debug!hyperlight_host,hyperlight_testing, andhyperlight_component_utilto tracingtracing_logto providelog::Levelandlog::Recordtypes where needed for compatibilityGuest Environment
logdependency inhyperlight_guest_binandhyperlight_guest_capi(required forlog::Logtrait implementation)logtohyperlight_commonas non-optional dependency for guest compatibilityType Conversions
From<log::Level>forLogLevelinhyperlight_commonto bridge guest logger outputlevel_filter_to_u64()andguest_level_to_log_level()helpers for type conversions between tracing and log typesTryFrom<&FbLogLevel>to avoid trait conflictsArchitecture
The existing
loggingandtracingexamples demonstrate both log-to-tracing bridge usage and native tracing features.Original prompt
tracingcrate instead oflogto create logs #1028💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.