Git Product home page Git Product logo

Comments (10)

cpx86 avatar cpx86 commented on June 11, 2024 1

I'm a bit undecided at the moment, to be honest. I'd like to avoid having any container abstraction or service locator within the library. One question is for which scenarios we need logging. E.g. for general purpose actor logging, it can be injected via the actor producer. To log e.g. all received messages, it can be added as a middleware. If we want to log mailbox events, that can be done with the mailbox statistics extension. If there are more use cases, perhaps we can provide similar extension points for those?

from protoactor-dotnet.

cpx86 avatar cpx86 commented on June 11, 2024

Seems to be the standard for typical logging scenarios - see comment in the aspnet/Logging repo here: aspnet/Logging#332 (comment)

Another option that could be interesting is EventSource/ETW logging. E.g. if we want to log diagnostics.

from protoactor-dotnet.

adamhathcock avatar adamhathcock commented on June 11, 2024

I'm interested in taking a stab at this. How should this be done?
For internal logging only?
Added to the context like Akka.net? (I guess this is correct?)

I'm used to dependency injection so if something needs logging it just asks for it.

from protoactor-dotnet.

adamhathcock avatar adamhathcock commented on June 11, 2024

Giving this a go and running into chicken-and-egg problems.

I can't just replace all usages of Console with logger because things like EventStream are always static. There's a lot of this.

I want to solve this by changing Props to really be IServiceProvider and use IoC to create objects. I'm guessing this is probably an unwelcome change.

from protoactor-dotnet.

adamhathcock avatar adamhathcock commented on June 11, 2024

Any thoughts about using IoC to resolve/create the proto actor primatives to inject logging? I would use the interfaces and stuff from the Microsoft.Extensions like logging.

I can try my best with a static implementation if that's desired instead.

@rogerasling @cpx86

from protoactor-dotnet.

adamhathcock avatar adamhathcock commented on June 11, 2024

Actor logging can be done themselves via the producer. I was going to optionally allow usage from the context because I figured the library itself would use that.

However I don't know how a logger factory can be shared among the primatives. Maybe nothing is needed.

from protoactor-dotnet.

rogeralsing avatar rogeralsing commented on June 11, 2024

In Go, we have a special EventStream where we push a LogMessage onto.
That way, anyone can subscribe to that and apply whatever log we want.
I think that would be the cleanest here too.

e.g.
Proto.Log.Stream.Subscribe( e => { myLogger.Warn(..) })

from protoactor-dotnet.

adamhathcock avatar adamhathcock commented on June 11, 2024

Cool. I'll look at ripping that off.

from protoactor-dotnet.

rogeralsing avatar rogeralsing commented on June 11, 2024

I've refactored the eventstream a little bit so it is possible to create a generic instance of it.
e.g.:

var stream = new EventStream<LogMessage>();

from protoactor-dotnet.

cpx86 avatar cpx86 commented on June 11, 2024

Fixed by #81

from protoactor-dotnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.