1.0.5 • Published 2 years ago

tauri-logger v1.0.5

Weekly downloads
-
License
GPL-3.0-or-later
Repository
-
Last release
2 years ago

Log critical actions through your frontend like you would do with console.log and store them locally!

IMPORTANT! Don't forget to set your scopes:

If you use the default dir-name option (see below)

"tauri": {
        "allowlist": {
		"fs": {
			"createDir": true,
			"writeFile": true,
			"scope": ["$DOCUMENT/YOURAPPNAME/logs"]
			}
		}
}

Or if you use a custom dir name you will have to change the YOURAPPNAME accordingly

"scope": ["$DOCUMENT/YOURCUSTOMDIRNAME/logs"]

This can be utilized to write logs of certain specified actions:

function criticalFunction() {
	try {
		tauriLog("critical function success")
	}
	catch (e)
		tauriLog("Crashed: " e)
}

To use the logger, place the function

initializeLogger()

inside your index.js/ts file

Then use

tauriLog(action)

whenever you want to log something

Errors produced by your frontend are logged automaticly unless you set the option to false

initializeLogger({
	reportErrors: false
})

A DiagnosticReport is also included by default unless turned off (includes appName, appVersion and the used tauriVersion)

initializeLogger({
	diagnosticReport: false
})

The default directory where the logs are stored is the Document folder, inside which a directory with you app name will be created

The app name is retrieved from the config file created by tauri

Example:

"package": {
        "productName": "your-appname",
    },

You can also set a custom dir that will be created in the Document Folder

initializeLogger({
	customDirName: "yourDirName"
})

If you encounter any problems or want to contribute feel free to do so!!!

Github Repo

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago