Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dan0xe/ta-logger
taLog is a frontend logger for Tauri applications, designed to log critical actions and store them locally for easy debugging and analysis.
https://github.com/dan0xe/ta-logger
error-monitoring error-reporting logger logger-interface logging tauri tauri-app tauri-plugin tool
Last synced: 2 months ago
JSON representation
taLog is a frontend logger for Tauri applications, designed to log critical actions and store them locally for easy debugging and analysis.
- Host: GitHub
- URL: https://github.com/dan0xe/ta-logger
- Owner: Dan0xE
- License: mit
- Created: 2022-06-13T21:53:59.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-26T12:55:48.000Z (over 1 year ago)
- Last Synced: 2024-10-29T04:41:18.077Z (2 months ago)
- Topics: error-monitoring, error-reporting, logger, logger-interface, logging, tauri, tauri-app, tauri-plugin, tool
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/ta-logger
- Size: 1.73 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TaLog
> A frontend logger for Tauri applications, designed to log critical actions and store them locally for easy debugging and analysis.
---
## 🛠️ Configuration: Set Your Scopes
### For the default directory name option:
Define the scopes in your Tauri configuration in the following manner:```json
"tauri": {
"allowlist": {
"fs": {
"createDir": true,
"writeFile": true,
"scope": [
"$DOCUMENT/YOUR_APP_NAME/logs"
]
}
}
}
```Substitute **YOUR_APP_NAME** with the name found in your tauri config
```json
"package": {
"productName": "test-app", //<--
///
},
```### For a custom directory name:
```json
"scope": ["$DOCUMENT/CUSTOM_DIRNAME/logs"]
```Where CUSTOM_DIRNAME is the name of the directory you want to use.
Use the directory name that you specify here and pass it to the `customDirName` option as described below.---
## 📝 Usage: Log Actions As Required
Logging actions:
Utilize the `log`, `warning`, or `error` methods in the TauriLogger class to log significant events within your critical functions or actions:```ts
function criticalFunction() {
try {
taLog.log("critical function success");
} catch (e) {
taLog.error("Crashed: " + e);
}
}
```### Initialize the logger:
First import `taLog` from the npm package.
Then invoke the `initializeLogger` method with appropriate options:```ts
taLog.initializeLogger({
reportErrors: true,
customDirName: "myCustomDir",
diagnosticReport: true,
consoleLog: true
});
```## ⚙️ Options
### Frontend error logging:
By default, errors are automatically logged. However, you can set the `reportErrors` option to **false** if you wish to disable automatic error logging.
### Diagnostic report:
The logger provides a diagnostic report by default, which includes the application's name, version, and the utilized Tauri version. This feature can be disabled by setting the `diagnosticReport` option to **false**.
### Console logging:
By default, logging to the console is disabled. It can be enabled by setting the `consoleLog` option to **true**.### Custom directory:
By passing a `customDirName` option to the `initializeLogger` method, you can specify a custom directory for your log files.---
## 🤝 Contributing
Should you encounter any issues or wish to contribute, you're welcome to do so!