Skip to content

Conversation

@grypez
Copy link
Contributor

@grypez grypez commented Apr 29, 2025

Closes: #217

This PR constitutes the majority of the lift for the referenced logging ticket.

@metamask/logger

  • implements a protocol for serialized transfer of log entries over a @metamask/streams DuplexStream
  • adds the injectStream method to the Logger for subscribing to logger notifications
  • adds makeArrayTransport which returns a transport which appends log entries to the supplied array argument

@metamask/ocap-kernel

  • The logger passed to the Kernel constructor is plumbed to subcomponents all the way to the vat user code's console endowment and logger power.

@ocap/kernel-test

  • no longer relies on intercepting process.stdout to assert expected test vat operations
  • utilizes logger tags for distinguishing different vat operations

@grypez grypez force-pushed the grypez/yalb branch 8 times, most recently from e7be85f to dd4973a Compare May 5, 2025 16:11
@grypez grypez changed the title stream vat logs to kernel feat(ocap-kernel): Implement hierarchical logging May 5, 2025
@grypez grypez force-pushed the grypez/yalb branch 2 times, most recently from e7042df to 4e04c6b Compare May 5, 2025 17:24
@grypez grypez marked this pull request as ready for review May 5, 2025 17:37
@grypez grypez requested a review from a team as a code owner May 5, 2025 17:37
Copy link
Contributor

@sirtimid sirtimid left a comment

Choose a reason for hiding this comment

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

btw I noticed that the log methods (log, debug, info, etc.) are created using function binding but aren't hardened. We should alter the constructor of the Logger like so:

const bind = (level: LogLevel): LogMethod => 
    harden(this.#dispatch.bind(this, {
      ...this.#options,
      level,
    }) as LogMethod);

Thought this will probably brake some tests, so we should use the mocked SES environment there

sirtimid
sirtimid previously approved these changes May 5, 2025
@grypez grypez enabled auto-merge (squash) May 6, 2025 13:04
@grypez grypez merged commit c3fd01c into main May 6, 2025
22 checks passed
@grypez grypez deleted the grypez/yalb branch May 6, 2025 13:18
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.

Establish console / logger method convention.

3 participants