# log-to-file **Repository Path**: Jenva/log-to-file ## Basic Information - **Project Name**: log-to-file - **Description**: 用于cordova前端日志记录 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-06-26 - **Last Updated**: 2025-06-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # cordova-plugin-logtofile > Cordova plugin for writing logs to the filesystem. forked from andischerer/cordova-plugin-logtofile Logger uses [logback-android](https://github.com/tony19/logback-android) internally. ## Installation ```bash ``` ## Usage ```javascript // setup a logfile path (required) // this path is relative to your device sdcard storage directory window.logToFile.setLogfilePath('/myapp/log.txt', function () { // logger configured successfully }, function (err) { // logfile could not be written // handle error }); // get the logfilePath from the currently running logger instance window.logToFile.getLogfilePath(function (logfilePath) { // dosomething with the logfilepath }, function (err) { // handle error }); // get the all archived logfile paths as array window.logToFile.getArchivedLogfilePaths(function (archivedlogfiles) { // dosomething with the archived logs }, function (err) { // handle error }); // write logmessages in different loglevels window.logToFile.debug('Sample debug message'); window.logToFile.info('Sample info message'); window.logToFile.warn('Sample warn message'); window.logToFile.error('Sample error message'); ``` ## Logrotate If the logfile exceeds a filesize above 5MB the current logfile will be archived and zipped into the current logfiledirectory. The last 3 archived logfiles will be retained, older logs get deleted. The archived logfiles are reachable under the following filepattern: `{logfiledirectory}/{logfilename}.{index}.zip` ## Currently supported Platforms - Android ## TODOs - add more config options