Loading...
Loading...
Setup Sentry Logging in any project. Use when asked to add Sentry logs, enable structured logging, capture console logs, or integrate logging libraries (Consola, Loguru) with Sentry. Supports JavaScript, Python, and Ruby.
npx skill4agent add jaffrepaul/agent-skills sentry-setup-loggingSentry.loggersentry_sdk.logger| Platform | Min SDK | Enable Flag | Logger API |
|---|---|---|---|
| JavaScript | 9.41.0+ | | |
| Python | 2.35.0+ | | |
| Ruby | 5.24.0+ | | |
grep -E '"@sentry/(nextjs|react|node|browser)"' package.jsonSentry.init({
dsn: "YOUR_DSN",
enableLogs: true,
});integrations: [
Sentry.consoleLoggingIntegration({ levels: ["warn", "error"] }),
],Sentry.logger.info("User logged in", { userId: "123" });
Sentry.logger.error("Payment failed", { orderId: "456", amount: 99.99 });
// Template literals (creates searchable attributes)
Sentry.logger.info(Sentry.logger.fmt`User ${userId} purchased ${productName}`);| Library | Integration | Min SDK |
|---|---|---|
| Consola | | 10.12.0+ |
| Console capture | | 10.13.0+ |
pip show sentry-sdk | grep Versionsentry_sdk.init(
dsn="YOUR_DSN",
enable_logs=True,
)from sentry_sdk.integrations.logging import LoggingIntegration
integrations=[LoggingIntegration(sentry_logs_level=logging.INFO)]from sentry_sdk import logger as sentry_logger
sentry_logger.info("User logged in: {user_id}", user_id="123")
sentry_logger.error("Payment failed", order_id="456", amount=99.99)from sentry_sdk.integrations.loguru import LoguruIntegration
integrations=[LoguruIntegration(sentry_logs_level=LoggingLevels.INFO.value)]bundle show sentry-rubySentry.init do |config|
config.dsn = "YOUR_DSN"
config.enable_logs = true
config.enabled_patches << :logger # Optional: capture stdlib Logger
endSentry.logger.info("User logged in")
Sentry.logger.error("Payment failed. Order: %{order_id}", order_id: "456")beforeSendLog: (log) => log.level === "info" ? null : log,def before_send_log(log, hint):
return None if log["severity_text"] == "info" else logSentry.logger.info("Sentry logging test");| Issue | Solution |
|---|---|
| Logs not appearing | Verify SDK version, check |
| Too many logs | Use |
| Console not captured | Add |