timber-sdk
v0.1.0
Published
A simple logging SDK to easily send INFO, WARN, and ERROR runtime logs directly to centralized dashboard.
Downloads
10
Maintainers
Readme
Timber Logger NPM Package
A lightweight, efficient Node.js Server SDK for seamlessly sending runtime application logs to the Timber Logging Platform.
Features
- Configure with your unique API key and application name.
- Asynchronously pushes application runtime events to Timber logging backend.
- Supports standardized log levels (
INFO,WARN,ERROR).
Installation
Install the package via npm:
npm install timber-sdkUsage
1. Initialize the SDK
Import the SDK and instantiate your custom logger instance by passing your developer credentials and unique application name.
import timber from "timber-sdk";
const logger = timber({
apiKey: "your-api-key",
appName: "app-name",
});2. Send Logs
Use the logging methods across your application code to capture runtime events. The SDK automatically formats and dispatches the log with the correct level
// Log basic runtime information
logger.info("Server started on port 8080");
// Log minor warnings or suspicious events
logger.warn("Multiple failed login attempts from IP 192.168.1.1");
// Log critical bugs or exceptions
logger.error("Database connection failed: Connection refused");API Reference
timber(config:LoggerConfig): ILogger
The default function used to initialize your application's logging instance.
config.apiKey: string: Your unique Developer API key used to validate log ownership.config.appName: string: The exact unique name of your registered application (no whitespaces allowed).- Returns: A
ILoggerlogger object containing the logging methods below.
logger.info(message: string): void
Asynchronously sends a log payload with an INFO severity level.
message: string: The log message.
logger.warn(message: string): void
Asynchronously sends a log payload with an WARN severity level.
message: string: The log message.
logger.error(message: string): void
Asynchronously sends a log payload with an ERROR severity level.
message: string: The log message.
