
Security News
npm v12 Ships With Install Scripts Off by Default, Begins Deprecating 2FA-Bypass Tokens
npm v12 is generally available, turning install scripts off by default and beginning the deprecation of 2FA-bypass publishing tokens.
@ringcentral/mfe-logger
Advanced tools
A micro frontends framework for building Web applications
@ringcentral/mfe-logger is a flexible logging system based on Roarr, providing structured logging with configurable transports, middlewares, and integrations. It's designed to be extensible and adaptable to different environments and use cases.
npm install @ringcentral/mfe-logger
# or
yarn add @ringcentral/mfe-logger
You can visit https://github.com/ringcentral/ringcentral-mfe for more documentation.
import { useLogger, ConsoleTransport, ScriptErrorIntegration } from '@ringcentral/mfe-logger';
// Initialize the logger
const logger = useLogger({
name: 'my-application', // required
version: '1.0.0',
environment: 'development',
enabled: true,
transports: [
new ConsoleTransport({
enabled: true
})
],
integrations: [
new ScriptErrorIntegration({
enabled: true
})
]
});
// Use the logger
logger.info('Application started');
logger.debug('Debug information', { key: 'value' });
logger.warn('Warning message');
logger.error('Error occurred', new Error('Something went wrong'));
// Create a tagged logger for a specific component
const componentLogger = logger.tag('Component');
componentLogger.info('Component initialized');
Outputs logs to the browser console.
import { ConsoleTransport } from '@ringcentral/mfe-logger';
const consoleTransport = new ConsoleTransport({
enabled: true, // Enable console output
filter: 'context.logLevel:>= 20', // Only show logs with level >= 20 (info)
ignoreRule: [/sensitive/], // Ignore logs containing 'sensitive'
storage: localStorage // Storage to save settings
});
// Later enable/disable programmatically
consoleTransport.enable();
consoleTransport.disable();
// Set a filter query (uses Liqe syntax)
consoleTransport.setFilter('context.logLevel:>= 30'); // Only errors and higher
Persists logs to browser storage using IndexedDB.
import { StorageTransport } from '@ringcentral/mfe-logger';
const storageTransport = new StorageTransport({
enabled: true,
prefix: 'myapp', // Prefix for the database name
batchNumber: 1024 * 256, // Custom batch size (256KB)
batchTimeout: 1000 * 60 * 2, // Custom timeout (2 minutes)
expired: 1000 * 60 * 60 * 48, // Custom expiration (48 hours)
maxLogsSize: 1024 * 1024 * 50, // Custom max size (50MB)
recentTime: 1000 * 60 * 30 // Custom recent time (30 minutes)
});
// Save current logs to database
await storageTransport.saveDB();
// Get logs from the last hour (default)
const logs = await storageTransport.getLogs();
// Get logs with custom parameters
const customLogs = await storageTransport.getLogs({
name: 'custom-export',
recentTime: 1000 * 60 * 60 * 24, // Last 24 hours
extraLogs: [
{
fileName: 'extra.log',
log: 'Additional log content'
}
]
});
// Download logs as a zip file
await storageTransport.downloadLogs();
The storage transport implements the following default behavior:
getLogs and downloadLogs methods retrieve logs from the last hour by defaultThese defaults can be customized when initializing the storage transport.
Automatically captures unhandled errors and promise rejections.
import { ScriptErrorIntegration } from '@ringcentral/mfe-logger';
const scriptErrorIntegration = new ScriptErrorIntegration({
enabled: true
});
Provides integration with the browser console for easier debugging.
import { ConsoleIntegration } from '@ringcentral/mfe-logger';
const consoleIntegration = new ConsoleIntegration();
Intended for integrating with HTTP clients to log network requests.
import { HttpClientIntegration } from '@ringcentral/mfe-logger';
const httpClientIntegration = new HttpClientIntegration();
Tagged loggers are useful for organizing logs by component or feature:
// Create a logger for a specific feature
const featureLogger = logger.tag('FeatureName');
// Create a logger with multiple tags
const subFeatureLogger = logger.tag('FeatureName', 'SubFeature');
// Logs will show the full namespace: [AppName:FeatureName:SubFeature]
subFeatureLogger.info('Log message');
You can enable or disable logging at runtime:
// Disable all logging
logger.disable();
// Enable logging again
logger.enable();
// Check if logging is enabled
if (logger.enabled) {
// Do something
}
Middlewares can transform log context and parameters:
import { useLogger } from '@ringcentral/mfe-logger';
// Simple middleware example
const myMiddleware = {
handleContext(context) {
// Add custom properties to context
return {
...context,
customProperty: 'value'
};
},
handleParams(params) {
// Transform or format parameters
if (Array.isArray(params)) {
return params.map(p => typeof p === 'object' ? JSON.stringify(p) : p).join(' ');
}
return params;
}
};
const logger = useLogger({
name: 'my-app',
middlewares: [myMiddleware]
});
Appropriate Log Levels: Use the correct log level based on the importance and type of information:
trace: Extremely detailed information (rarely used)debug: Debugging information useful during developmentinfo: General information about application flowwarn: Warning situations that don't cause errorserror: Error conditions that affect operationfatal: Critical errors causing application shutdownStructured Logging: Pass objects along with messages for better searchability:
logger.info('User logged in', { userId: '123', timestamp: Date.now() });
Tagged Loggers: Create tagged loggers for different parts of your application to easily filter logs.
Error Handling: Use the error transport for catching unhandled errors in production.
Performance Considerations: Be mindful of the performance impact of verbose logging in production environments.
FAQs
A micro frontends framework for building Web applications
The npm package @ringcentral/mfe-logger receives a total of 39 weekly downloads. As such, @ringcentral/mfe-logger popularity was classified as not popular.
We found that @ringcentral/mfe-logger demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
npm v12 is generally available, turning install scripts off by default and beginning the deprecation of 2FA-bypass publishing tokens.

Research
/Security News
Socket tracks the activity as Operation “Muck and Load”: a threat actor uses commit-farming workflows, public dead drops, and protected archives to stage Windows RAT and infostealer malware.

Security News
pnpm 11.10 hardens registry auth to block token redirection, tightens pack-app and deploy, and makes the Rust port (v12) installable.