mirror of
				https://github.com/Ylianst/MeshCentral.git
				synced 2025-03-09 15:40:18 +00:00 
			
		
		
		
	meshuser: log uncaught exceptions to mesherrs
This commit is contained in:
		
							parent
							
								
									ff4c67da7c
								
							
						
					
					
						commit
						ad6ff11413
					
				
					 2 changed files with 12 additions and 6 deletions
				
			
		|  | @ -495,15 +495,19 @@ function CreateMeshCentralServer(config, args) { | |||
|             console.log('ERR: ' + datastr); | ||||
|             if (data.startsWith('le.challenges[tls-sni-01].loopback')) { return; } // Ignore this error output from GreenLock
 | ||||
|             if (data[data.length - 1] == '\n') { data = data.substring(0, data.length - 1); } | ||||
|             try { | ||||
|                 var errlogpath = null; | ||||
|                 if (typeof obj.args.mesherrorlogpath == 'string') { errlogpath = obj.path.join(obj.args.mesherrorlogpath, 'mesherrors.txt'); } else { errlogpath = obj.getConfigFilePath('mesherrors.txt'); } | ||||
|                 obj.fs.appendFileSync(errlogpath, '-------- ' + new Date().toLocaleString() + ' ---- ' + getCurrentVersion() + ' --------\r\n\r\n' + data + '\r\n\r\n\r\n'); | ||||
|             } catch (ex) { console.log('ERROR: Unable to write to mesherrors.txt.'); } | ||||
|             obj.logError(data); | ||||
|         }); | ||||
|         childProcess.on('close', function (code) { if ((code != 0) && (code != 123)) { /* console.log("Exited with code " + code); */ } }); | ||||
|     }; | ||||
| 
 | ||||
|     obj.logError = function (err) { | ||||
|         try { | ||||
|             var errlogpath = null; | ||||
|             if (typeof obj.args.mesherrorlogpath == 'string') { errlogpath = obj.path.join(obj.args.mesherrorlogpath, 'mesherrors.txt'); } else { errlogpath = obj.getConfigFilePath('mesherrors.txt'); } | ||||
|             obj.fs.appendFileSync(errlogpath, '-------- ' + new Date().toLocaleString() + ' ---- ' + getCurrentVersion() + ' --------\r\n\r\n' + err + '\r\n\r\n\r\n'); | ||||
|         } catch (ex) { console.log('ERROR: Unable to write to mesherrors.txt.'); } | ||||
|     }; | ||||
| 
 | ||||
|     // Get current and latest MeshCentral server versions using NPM
 | ||||
|     obj.getLatestServerVersion = function (callback) { | ||||
|         if (callback == null) return; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue