4.3 KiB
Command Line Interface
LogWisp provides a comprehensive set of command-line options for controlling its behavior without modifying configuration files.
Synopsis
logwisp [options]
General Options
--config <path>
Specify the configuration file location.
- Default:
~/.config/logwisp.toml - Example:
logwisp --config /etc/logwisp/production.toml
--router
Enable HTTP router mode for path-based routing of multiple streams.
- Default:
false(standalone mode) - Use case: Consolidate multiple HTTP streams on shared ports
- Example:
logwisp --router
--version
Display version information and exit.
- Example:
logwisp --version
--background
Run LogWisp as a background process.
- Default:
false(foreground mode) - Example:
logwisp --background
Logging Options
These options override the corresponding configuration file settings.
--log-output <mode>
Control where LogWisp writes its own operational logs.
- Values:
file,stdout,stderr,both,none - Default: Configured value or
stderr - Example:
logwisp --log-output both
Output Modes:
file: Write logs only to filesstdout: Write logs only to standard outputstderr: Write logs only to standard errorboth: Write logs to both files and consolenone: Disable logging (⚠️ SECURITY: Not recommended)
--log-level <level>
Set the minimum log level for LogWisp's operational logs.
- Values:
debug,info,warn,error - Default: Configured value or
info - Example:
logwisp --log-level debug
--log-file <path>
Specify the log file path when using file output.
- Default: Configured value or
./logs/logwisp.log - Example:
logwisp --log-output file --log-file /var/log/logwisp/app.log
--log-dir <directory>
Specify the log directory when using file output.
- Default: Configured value or
./logs - Example:
logwisp --log-output file --log-dir /var/log/logwisp
--log-console <target>
Control console output destination when using stdout, stderr, or both modes.
- Values:
stdout,stderr,split - Default:
stderr - Example:
logwisp --log-output both --log-console split
Console Targets:
stdout: All logs to standard outputstderr: All logs to standard errorsplit: INFO/DEBUG to stdout, WARN/ERROR to stderr (planned)
Examples
Basic Usage
# Start with default configuration
logwisp
# Use a specific configuration file
logwisp --config /etc/logwisp/production.toml
Development Mode
# Enable debug logging to console
logwisp --log-output stderr --log-level debug
# Debug with file output
logwisp --log-output both --log-level debug --log-dir ./debug-logs
Production Deployment
# File logging with info level
logwisp --log-output file --log-dir /var/log/logwisp --log-level info
# Background mode with custom config
logwisp --background --config /etc/logwisp/prod.toml
# Router mode for multiple services
logwisp --router --config /etc/logwisp/services.toml
Troubleshooting
# Maximum verbosity to stderr
logwisp --log-output stderr --log-level debug
# Check version
logwisp --version
# Test configuration without backgrounding
logwisp --config test.toml --log-level debug
Priority Order
Configuration values are applied in the following priority order (highest to lowest):
- Command-line flags - Explicitly specified options
- Environment variables -
LOGWISP_*prefixed variables - Configuration file - TOML configuration
- Built-in defaults - Hardcoded fallback values
Exit Codes
0: Successful execution1: General error (configuration, startup failure)2: Invalid command-line arguments
Signals
LogWisp responds to the following signals:
SIGINT(Ctrl+C): Graceful shutdownSIGTERM: Graceful shutdownSIGKILL: Immediate termination (not recommended)
During graceful shutdown, LogWisp will:
- Stop accepting new connections
- Finish streaming to existing clients
- Flush all buffers
- Close all file handles
- Exit cleanly
See Also
- Configuration Guide - Complete configuration reference
- Environment Variables - Environment variable options
- Router Mode - Path-based routing details