Logger interface
Tafrigh accepts any logger that implements theLogger interface:
Using the console logger
The simplest way to enable logging is to use the built-inconsole object:
Using Pino
Pino is a fast, low-overhead JSON logger:Using Winston
Winston is a popular multi-transport logger:Custom logger implementation
You can create a custom logger that integrates with your existing logging infrastructure:Partial logger implementation
You only need to implement the log levels you want:Log levels and what they capture
trace
Most verbose level, includes detailed operation information:- Individual transcript results for each chunk
- Internal state transitions
debug
Development and troubleshooting information:- Temporary directory paths
- Generated chunk file lists
- Concurrency mode selection
- Worker thread counts
info
General operational information:- Transcription start with parameters
- API key usage (masked for security)
- Preprocessing and splitting status
- Cleanup operations
warn
Potential issues that don’t prevent operation:- Empty transcription results
- Skipped chunks
- Retryable failures
error
Failures that prevent successful completion:- Failed chunk transcriptions
- API errors
- File system errors
Example log output
Here’s what you’ll see withconsole logging enabled:
API key masking
Tafrigh automatically masks API keys in log output for security:src/transcriber.ts:13-15:
Logging in production
For production environments, consider:Disabling logging
Logging is disabled by default. Simply omit thelogger option:
src/utils/logger.ts:3-10 is a no-op:
Combining logging with callbacks
You can use both logging and callbacks for comprehensive monitoring:Debugging tips
Enable trace logging to see all transcripts
Enable trace logging to see all transcripts
Preserve temporary files for inspection
Preserve temporary files for inspection
Log to both console and file
Log to both console and file
Next steps
Callbacks
Monitor progress with callback functions
Error handling
Handle and log transcription errors
Concurrency
Monitor parallel transcription workers
Resuming failures
Log retry attempts and failures