Comments (8)
Hi @alde103 - That seems like a good feature to add. Perhaps it's a configuration key that specifies a callback and the default callback is to log the message. For your use case, you'd pass a function that sends a message. What do you think of that?
from muontrap.
I'm interested in this as well! Was thinking about hacking the into
to pass a collectible that I implement with a callback
from muontrap.
Adding an :into
option to MuonTrap.Daemon.start_link
sounds like a really good idea.
from muontrap.
Hi all,
@fhunleth, Which one do you like best?
- Use the using macro with the whole @callback ceremony (the default callback would be logging it).
- Use a key (
:into
) in the state for the callback function (anonymous function) that is called every time there is a new message (default the log function).
from muontrap.
Hi @fhunleth, Would you be interested in Muontrap.Daemon.Server??, it would be a module that implements a behaviour that wraps MuonTrap.Daemon
for handling daemon messages with GenServer's states.
from muontrap.
I'm not sure about Muontrap.Daemon.Server
. It feels like there should be other ways of accomplishing the same thing that require significantly less code:
- Create your own
GenServer
that runs themuontrap
port binary likeMuontrap.Daemon
, but has your custom code. - Have
Muontrap.Daemon
emit telemetry events and attach to those. I feel like we're exploring that the PR. I'm also exploring this in another library and will hopefully have stronger opinions on:telemetry
soon. - Write a GenServer to monitor your
Muontrap.Daemon
GenServer that you want to run some code when it exits.
Could you talk about your use case? Perhaps that will help me understand better.
from muontrap.
In short, my application will run a configurable number of unspecified daemons (configurable at runtime), whose logs/outputs will be processed based on runtime configurable Regex and are propagated to the rest of the application.
And as you mention, my current approach is to use (1) but I think some features of MuonTrap.Daemon
are desirable to make the application more scalable.
Also, I would like to reduce the ceremonial code to the final user, which is one of Muontrap.Daemon.Server
purposes.
Muontrap.Daemon.Server
could be restructured so that instead of relying on direct messages from MuonTrap.Daemon
, it would use telemetry
events.
from muontrap.
Hi, I was recommended this project today (which is great!) but I also ran into this limitation.
I don't know if anything has changed since this discussion, but could this be solved by supplying an optional log_fn/1
to the Daemon
? This would allow us to add custom log-processing logic in a relatively straightforward way.
from muontrap.
Related Issues (13)
- Attempt to convert args to binaries HOT 3
- Log stderr when running a daemon
- Windows support. HOT 4
- Fails to compile when there's a space somewhere in the absolute path HOT 4
- Delay to sigkill HOT 2
- Establishing/Supervising Communications With a Long-Running, Data Streaming Python Process HOT 3
- Escript Troubles HOT 8
- No Works with Nerves HOT 3
- cgroup support no longer working on Linux 5.15
- Compiler error on Ubuntu 20.04
- Add test to verify killing chatty processes
- Support new/updated logger levels
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from muontrap.