

Better JS Logging for Micro-Frontends, Browser, Node
source link: https://dev.to/ajstacy/better-js-logging-for-micro-frontends-browser-node-dgl
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Better JS Logging for Micro-Frontends, Browser, Node
Aug 13
・2 min read
Official documentation can be found here:
https://adzejs.com
Hey everyone, I recently released version 1.1 of Adze, a library that solves a lot of the pain points of handling logs in multiple environments and logging with modular systems like micro-frontends.
As you may already be aware there are a number of other good JS libraries out there to assist with logging. The focus of Adze is to provide a convenient and clean API, provide first-class TypeScript support, and to empower you to take command of your logs rather than pigeon-hole you into a specific way of handling them.
Here is a list of the features that Adze provides:
- First-class TypeScript support
- Multi-environment support for the Browser and Node
- Wraps and extends the entire standard API
- A fluent, chainable API
- Log Listeners for capturing log data
- Log annotation namespaces, labels, and other meta data
- Attractive styling (EMOJI'S INCLUDED and consistent across major browsers)
- Everything is configurable
- Enables completely custom log levels
- A global log store for recalling logs and overriding configuration (supports micro-frontends and modules)
- Support for Mapped Diagnostic Context
- Convenient unit testing environment controls
- Advanced Log Filtering
- and much more...
Beyond the new features that Adze provides you, it also wraps the entire console web standard.
Example:
// ----- setup.js ----- //
import { adze, createShed } from 'adze';
// Adze can be used without any configuration.
adze().log('Hello World!');
// But you'll likely want to set it up like this...
/* A shed is a global log store used for listeners and caching
as well as configuration overrides. */
const shed = createShed();
/* Let's create a log listener to transport our log data
to a destination. We'll listen to all log levels. */
shed.addListener('*', (data, render) => {
/* If a log does not render then we will ignore transporting
it. */
if (render) {
// Do transport logic here.
}
});
// Let's create an Adze configuration (or import it from an env file).
const cfg = {
logLevel: 1,
};
// Now we'll create a new factory using seal
export const log = adze(cfg).label('foo').count.seal();
// ----- elsewhere.js ----- //
import { log } from '~/setup.js';
// And now we can create new logs using our new factory
log().error('An error occurred! Oh no!');
log().error('Another error occurred! Quick! Help!');
log().log("I won't display because my log level is too high.");
Recommend
-
27
Today, we are aware that we should normally not have our whole enterprise in one service, so we split up the enterprise architecture in smaller services, microservices. But we are also starting to realize that we have the sam...
-
32
Brilliant micro-frontends joke :joy: I don’t understand micro-frontends. Yesterday, after coming back from...
-
39
In recent years,microservices have exploded in popularity, with many organisations using this architectural style to avoid the limitations of large, monolithic backends. While much has been written about this style of bu...
-
43
Micro-frontend architecture is a design approach in which afront-end app is decomposed into individual, semi-independent “microapps” working loosely together. The micro-frontend concept is vaguely inspired by, and named...
-
36
How to share dependencies in Micro Frontends Florian Rappl
-
26
Story behind Micro Frontends in Sabre
-
26
One of the more controversial topics in frontend web dev is microfrontends. Are they worth it? Should you really split up your application? Do you really need to use this now ? ...
-
8
Micro FrontendsMFEs is an architectural style that aims to optimize frontend development. It does so by breaking up the frontend into small and decoupled codebases. These codebases are easier to understand and maintain. The...
-
5
The Future of Micro-FrontendsI have to understand what are the missing pieces of this puzzle and try to picture what would make this architecture approach even betterPhoto by
-
5
Better SEO in Mobile Apps with Micro Frontends: A Comprehensive Guide
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK