Comments (2)
Hi Peter,
regarding the synchronous publisher, it is a decision/constraint I've made early on and described in the internals.
For the intended use of this library, events are something useful but not essential, something that can be dropped/discarded as long as the handling of the events doesn't impact the "normal flow of the program".
A synchronous publisher would impact the performances of each event logged thus contradicting the design goals,
and in some case could also alter the flow which is definitely something i'm trying to avoid.
There are plenty of articles mentioning how logging can impact performances and stability.
I have a good experience building event-sourced systems and it is extremely difficult to build a general-purpose library to record events. There are fundamental decisions which need to be made case by case most of which boil down to where to you keep the events before acknowledgement and whether failing to store an event should fail the client acknowledgement as well.
These decisions will be different in different environments and for different type of events. Such decisions fit more the world of a framework rather than a library. Such frameworks will be built with different technologies for clouds and traditional environments.
Regarding the second part, the global logger, although µ/log has a default global logger, the fundamental core logging function log*
takes a logger
which is a dynamic binding which in the log
macro defaults to core/*default-logger*
and can be redefined with binding
.
(binding [com.brunobonacci.mulog.core/*default-logger* (atom (rb/ring-buffer 1000))]
(µ/log ::my-event :tag1 "val1"))
However, if your intent is to send a different set of events to different publishers, then the best way to achieve this is to use :transform
configuration available in all built-in publishers.
Here an example
(μ/start-publisher!
{:type :multi
:publishers
[{:type :console}
{:type :simple-file :filename "/tmp/mulog/events1.log"
:transform #(filter (where :mulog/event-name :in? [:foo :bar]) %)}
{:type :simple-file :filename "/tmp/mulog/events2.log"
:transform #(filter (where :mulog/event-name :in? [:baz :bar]) %)}]})
(this example uses the where library to create predicate functions)
In the above example only the events :foo
and :bar
are sent to file "/tmp/mulog/events1.log"
,
and only the events :baz
and :bar
are sent to file "/tmp/mulog/events2.log"
,
finally all the events are published on the console.
from mulog.
Hi Bruno,
thank you for your quick response. I am aware of your choices and they make a lot of sense for logging. I was just thinking if this particular shoe wouldn't fit 2 different feet :) Your experience says no. Thank you.
from mulog.
Related Issues (20)
- Character code for `µ` HOT 2
- Does mulog publisher for zipkin support Annotations? HOT 1
- Extract file/line info from callsites?
- µ/log publisher for OpenTelemetry HOT 6
- add config for expanding mbean attributes into individual logs HOT 9
- Datadog exporter HOT 2
- DEPRECATION WARNING: on `:filesystem-metrics` sampler config option
- DEPRECATION WARNING: on `:mbean` sampler config option
- timestamp accuracy HOT 2
- Elasticsearch returns HTTP 200 even when some items are failed. HOT 2
- [docs] incorrect link to json-encode page
- incorrect namespace in `mulog/log` HOT 2
- JSON-file publisher? HOT 4
- `:data-stream` shows up as index in Elasticsearch 8 HOT 3
- :mulog/publisher-error NullPointerException HOT 4
- Cascading errors in elasticsearch publisher when using multi publisher HOT 8
- mulog-elasticsearch does not work with data-streams HOT 3
- suggestion: lmax disruptor queues HOT 2
- ElasticSearch `type-mangle` fn causes type problems HOT 1
- Put event name in options map HOT 1
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 mulog.