Logging Configuration
Control logging behavior with console logging, electron-log integration, or disable logging entirely (since v1.9.0).
See Configuration Documentation for all available configuration options.
Configuration Options
This behavior is controlled by the logConfig
option, which accepts the following values:
Option | Description |
---|---|
Falsy value | Any falsy value (see MDN Falsy) results in no logs being recorded. |
"console" | Logs messages to the console using the built-in console object. |
{} (JSONObject, default) | A valid configuration object for electron-log. This object defines how logs are handled. |
The JSON object provided for electron-log must follow the configuration options specified in the electron-log documentation.
Configuration Examples
Default Configuration
The default configuration sets the console logging level to info
and disables file logging:
{
"logConfig": {
"transports": {
"console": {
"level": "info"
},
"file": {
"level": false
}
}
}
}
Minimal Configuration
Simply provide an empty object to use the default electron-log settings:
{
"logConfig": {}
}
Advanced Configuration
Customize the console log format and enable file logging with rotation:
{
"logConfig": {
"transports": {
"file": {
"maxSize": 100000,
"format": "{processType} [{h}:{i}:{s}.{ms}] {text}",
"level": "debug"
},
"console": {
"format": "[{h}:{i}:{s}.{ms}] {text}",
"level": "info"
}
}
}
}
Debug Configuration
For troubleshooting, enable verbose debug logging:
{
"logConfig": {
"transports": {
"console": {
"level": "debug"
},
"file": {
"level": "debug",
"maxSize": 1000000
}
}
}
}
Command Line Usage
You can also configure logging via command line arguments:
# Enable debug logging
teams-for-linux --logConfig='{"transports":{"console":{"level":"debug"}}}'
# Disable all logging
teams-for-linux --logConfig=false
# Use console logging only
teams-for-linux --logConfig="console"
Log Levels
Available log levels (in order of verbosity):
- error - Only error messages
- warn - Warnings and errors
- info - Informational messages, warnings, and errors
- verbose - Detailed information for troubleshooting
- debug - All messages including debug information
- silly - Maximum verbosity (not recommended for production)
File Logging Options
When using file transport, you can configure:
Option | Description | Default |
---|---|---|
level | Minimum log level to record | "info" |
maxSize | Maximum file size in bytes | 1048576 (1MB) |
format | Log message format string | "[{y}-{m}-{d} {h}:{i}:{s}.{ms}] [{level}] {text}" |
fileName | Log file name | "main.log" |
Troubleshooting Logging
Common Issues
Logs Not Appearing
- Check log level: Ensure the configured level includes your message level
- Verify configuration: Validate JSON syntax in logConfig
- File permissions: Ensure write access to log directory
Large Log Files
- Set maxSize: Configure file rotation with appropriate size limits
- Adjust log level: Use less verbose levels in production
- Regular cleanup: Implement log file rotation and cleanup
Debug Information
To diagnose logging issues, temporarily enable debug mode:
teams-for-linux --logConfig='{"transports":{"console":{"level":"debug"}}}'
Limitations
Not all options available in electron-log have been fully tested, especially those that require a function as a configuration value.
Related Documentation
- Configuration Options - Complete configuration reference
- Troubleshooting - General troubleshooting guide