
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
@mastra/loggers
Advanced tools
Affected versions:
A collection of logging transport implementations for Mastra, extending the LoggerTransport class from @mastra/core.
npm install @mastra/loggers
A transport that writes logs to a local file system.
import { FileTransport } from '@mastra/loggers';
const fileLogger = new FileTransport({
path: '/path/to/logs/app.log',
});
path: Absolute path to the log file (must exist)A transport that sends logs to Upstash Redis with batching and auto-trimming capabilities.
import { UpstashTransport } from '@mastra/loggers';
const upstashLogger = new UpstashTransport({
upstashUrl: 'https://your-instance.upstash.io',
upstashToken: 'your-token',
listName: 'application-logs', // optional
maxListLength: 10000, // optional
batchSize: 100, // optional
flushInterval: 10000, // optional
});
Required:
upstashUrl: Your Upstash Redis instance URLupstashToken: Your Upstash authentication tokenOptional:
listName: Redis list name for logs (default: 'application-logs')maxListLength: Maximum number of logs to keep (default: 10000)batchSize: Number of logs to send in one batch (default: 100)flushInterval: Milliseconds between flush attempts (default: 10000)Both transports implement the LoggerTransport interface from @mastra/core:
import { Logger } from '@mastra/core/logger';
import { FileTransport, UpstashTransport } from '@mastra/loggers';
// Create transports
const fileTransport = new FileTransport({
path: '/var/log/app.log',
});
const upstashTransport = new UpstashTransport({
upstashUrl: process.env.UPSTASH_URL!,
upstashToken: process.env.UPSTASH_TOKEN!,
});
// Create logger with multiple transports
const logger = new Logger({
transports: [fileTransport, upstashTransport],
});
// Log messages
logger.info('Hello world', { metadata: 'value' });
// Query logs
const allLogs = await fileTransport.listLogs();
const runLogs = await upstashTransport.listLogsByRunId({ runId: 'abc-123' });
Both transports handle log messages in JSON format with the following structure:
interface BaseLogMessage {
time?: number; // Timestamp (auto-injected if not present)
level?: string; // Log level
msg?: {
// Message content
runId?: string; // Optional run ID for grouping logs
[key: string]: any;
};
[key: string]: any;
}
Both transports include robust error handling:
File Transport:
Upstash Transport:
FAQs
Unknown package
The npm package @mastra/loggers receives a total of 316,236 weekly downloads. As such, @mastra/loggers popularity was classified as popular.
We found that @mastra/loggers demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 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.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.