Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
morenol committed Feb 14, 2025
1 parent 26c4c90 commit fe4461d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 4 additions & 3 deletions sdf/how-to/operator_logging.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ SDF operators can output logs using standard output (stdout), which can then be

Within Rust operators, you can use the standard `println!` macro to write to stdout. The output will be captured and displayed when you execute `sdf log`.

This is particularly useful for debugging and understanding the context in which your operator is running. You can, for example, print the key using [`key()`](../concepts/operator-context.mdx#key-function) or the window boundaries using [`window()`](../concepts/operator-context.mdx#window-function
This is particularly useful for debugging and understanding the context in which your operator is running. You can, for example, print the key using [`key()`](../concepts/operator-context.mdx#key-function) or the window boundaries using [`window()`](../concepts/operator-context.mdx#window-function)

).

## Example

Code example of an update-state operator with some output sent to standard output.

```rust
fn add_count(input: String) -> Result<()> {
if let Some(k) = key() {
Expand All @@ -27,5 +29,4 @@ fn add_count(input: String) -> Result<()> {
println!("New counter value: {}", new_value);

Ok(())
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ SDF operators can output logs using standard output (stdout), which can then be

Within Rust operators, you can use the standard `println!` macro to write to stdout. The output will be captured and displayed when you execute `sdf log`.

This is particularly useful for debugging and understanding the context in which your operator is running. You can, for example, print the key using [`key()`](../concepts/operator-context.mdx#key-function) or the window boundaries using [`window()`](../concepts/operator-context.mdx#window-function
This is particularly useful for debugging and understanding the context in which your operator is running. You can, for example, print the key using [`key()`](../concepts/operator-context.mdx#key-function) or the window boundaries using [`window()`](../concepts/operator-context.mdx#window-function)

).

## Example

In an update operator we can do something like:

```rust
fn add_count(input: String) -> Result<()> {
if let Some(k) = key() {
Expand Down

0 comments on commit fe4461d

Please sign in to comment.