Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 16, 2025

Hyperlight was using both log and tracing crates inconsistently. This consolidates on tracing for the host runtime while maintaining log compatibility for guest environments.

Changes

Host Runtime

  • Replaced log:: macros with tracing:: equivalents throughout host code
  • Updated log_then_return! and debug! macros to use tracing::error! and tracing::debug!
  • Migrated hyperlight_host, hyperlight_testing, and hyperlight_component_util to tracing
  • Use tracing_log to provide log::Level and log::Record types where needed for compatibility

Guest Environment

  • Retained log dependency in hyperlight_guest_bin and hyperlight_guest_capi (required for log::Log trait implementation)
  • Added log to hyperlight_common as non-optional dependency for guest compatibility

Type Conversions

  • Added From<log::Level> for LogLevel in hyperlight_common to bridge guest logger output
  • Implemented level_filter_to_u64() and guest_level_to_log_level() helpers for type conversions between tracing and log types
  • Fixed TryFrom<&FbLogLevel> to avoid trait conflicts

Architecture

Host Runtime           Guest Environment
┌──────────────┐      ┌─────────────┐
│ tracing::*!  │      │ log::*!     │
│              │      │             │
│ tracing_log  │◄────►│ log::Level  │
│ (bridge)     │      │             │
└──────────────┘      └─────────────┘
        │                    │
        └────────────┬───────┘
                     ▼
            hyperlight_common
            (LogLevel conversions)

The existing logging and tracing examples demonstrate both log-to-tracing bridge usage and native tracing features.

Original prompt

This section details on the original issue you should resolve

<issue_title>Use tracing crate instead of log to create logs</issue_title>
<issue_description>We are currently using both the tracing and log crate to emit logs in Hyperlight. We should only use tracing that extends log's functionality and adds more features.

Furthermore, some examples would be nice to demonstrate the use of the hyperlight crate as a dependency and show how the logs can be retrieved regardless of which crate (log or tracing) the example uses.</issue_description>

<agent_instructions>there was a previous implementation, and that has context, note that it isn't fully correct becuase it needed a rebase #1044</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 5 commits December 16, 2025 22:37
Co-authored-by: jsturtevant <648372+jsturtevant@users.noreply.github.com>
Co-authored-by: jsturtevant <648372+jsturtevant@users.noreply.github.com>
Co-authored-by: jsturtevant <648372+jsturtevant@users.noreply.github.com>
Co-authored-by: jsturtevant <648372+jsturtevant@users.noreply.github.com>
Co-authored-by: jsturtevant <648372+jsturtevant@users.noreply.github.com>
Copilot AI changed the title [WIP] Use tracing crate for logging in Hyperlight Migrate from log to tracing crate for unified logging Dec 16, 2025
Copilot AI requested a review from jsturtevant December 16, 2025 23:16
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.

Use tracing crate instead of log to create logs

2 participants