Skip to content

Commit

Permalink
set up some logging in the hello world example.
Browse files Browse the repository at this point in the history
  • Loading branch information
perbu committed Nov 13, 2023
1 parent 0761f14 commit ca09d25
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion examples/helloworld/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ package main

import (
"fmt"
"github.com/anthdm/hollywood/log"
"log/slog"
"os"

"github.com/anthdm/hollywood/actor"
)
Expand All @@ -28,7 +31,8 @@ func (f *foo) Receive(ctx *actor.Context) {
}

func main() {
engine := actor.NewEngine()
lh := log.NewHandler(os.Stdout, log.JsonFormat, slog.LevelDebug)
engine := actor.NewEngine(actor.Config{Logger: log.NewLogger("[engine]", lh)})
pid := engine.Spawn(newFoo, "my_actor")
for i := 0; i < 100; i++ {
engine.Send(pid, &message{data: "hello world!"})
Expand Down

0 comments on commit ca09d25

Please sign in to comment.