Skip to content

Conversation

@tylerburdsall
Copy link
Contributor

@tylerburdsall tylerburdsall commented Oct 8, 2025

Adds .wit bindings for our host-supported log destinations. Deprecates old topic_logger in favor of the new one. Will be merged when host support is merged.

This also adds support for shipping logs to a desired CloudWatch Logs Group as well as splitting out specific log levels per destination. For example, you can set all logs DEBUG and higher to a topic, but only INFO and higher to a CW Logs Group.

Testing

Verified this works in development cell. Logging example correctly sent logs to my topic, including system logs (when specified).

$ momento topic subscribe --cache my-functions-cache logging-example
INFO [system] "2025-10-09T23:35:11.405715618Z" - web function started
INFO 2025-10-09T23:35:11.407336804Z logging momento-functions/examples/logging.rs:27 Received request: Request { name: "Tyler" }
INFO [system] "2025-10-09T23:35:11.407494289Z" - web function ended

Breaking changes

  • momento_functions_log::configure_logging now receives a Vec<ConfigureLoggingInput> so multiple destinations can be configured at once
  • momento_functions_log::configure_logging now returns a Result<(), LogConfigError> instead of SetLoggerError
  • TopicLogger is no longer supported; deprecated in favor of LogDestination::Topic

…favor of host-managed topics logger. updates examples.

fn log(&self, record: &log::Record) {
if self.enabled(record.metadata()) {
let mut buffer = String::with_capacity(128);
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder about this length restriction for the host-logging approach. Is it still appropriate?

Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't a restriction, it's an initial capacity to help avoid excessive reallocation. That said, we could reach for unsafe here too and reuse the buffer given the single-thread nature of Functions... Let's leave that for another time though :-)

Copy link
Contributor

@kvcache kvcache left a comment

Choose a reason for hiding this comment

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

mostly just have configuration quality of life feedback, which I think is pretty important ffor logging configuration!


fn log(&self, record: &log::Record) {
if self.enabled(record.metadata()) {
let mut buffer = String::with_capacity(128);
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't a restriction, it's an initial capacity to help avoid excessive reallocation. That said, we could reach for unsafe here too and reuse the buffer given the single-thread nature of Functions... Let's leave that for another time though :-)

@tylerburdsall tylerburdsall merged commit dd06f9c into main Nov 19, 2025
1 check passed
@tylerburdsall tylerburdsall deleted the feat/host-logging branch November 19, 2025 19:04
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.

4 participants