How to use the @awesomeeng/awesome-log.error function in @awesomeeng/awesome-log

To help you get started, we’ve selected a few @awesomeeng/awesome-log examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github awesomeeng / awesome-server / src / https / HTTPSServer.js View on Github external
server.on("error",(err)=>{
					Log.error("Error on HTTPS Server on "+hostname+":"+port+":",err);
				});
github awesomeeng / awesome-server / src / AwesomeServer.js View on Github external
catch (ex) {
						Log.error("Error in routing for "+url+".",ex);
						return reject(ex);
					}
				};

				nextRoute();
			});

			if (!response.finished) {
				Log.error("404 Not found "+url+".");
				await response.writeError(404,"404 Not found "+url+".");
			}
		}
		catch (ex) {
			Log.error("Error handling request "+url+".",ex);
			response.writeError(500,"Error handling request "+url+".");
		}
	}
}
github awesomeeng / awesome-server / src / AwesomeServer.js View on Github external
if (!clazz) {
		Log.error("Loaded controller not found "+filename);
		throw new Error("Loaded controller not found "+filename);
	}
	else if (clazz instanceof Function && Object.prototype.isPrototypeOf.call(AbstractController,clazz)) {
		let instance;
		try {
			instance = Reflect.construct(clazz,additionalArgs);
		}
		catch (ex) {
			Log.error("Error instantiating controller.",ex);
			throw ex;
		}
		if (!(instance instanceof AbstractController)) {
			Log.error("Loaded controller does not extend AbstractController "+filename);
			throw new Error("Loaded controller does not extend AbstractController "+filename);
		}

		if (this.config.informative) Log.info("Loaded controller from "+filename+".");
		_routeController.call(this,route,instance);
	}
	else if (clazz instanceof AbstractController) {
		if (this.config.informative) Log.info("Loaded controller from "+filename+".");
		_routeController.call(this,route,clazz);
	}
	else {
		Log.error("Loaded controller does not extend AbstractController "+filename);
		throw new Error("Loaded controller does not extend AbstractController "+filename);
	}

	return route;
github awesomeeng / awesome-server / src / AwesomeServer.js View on Github external
catch (ex) {
		Log.error("Error loading controller "+filename,ex);
		throw ex;
	}

	if (!clazz) {
		Log.error("Loaded controller not found "+filename);
		throw new Error("Loaded controller not found "+filename);
	}
	else if (clazz instanceof Function && Object.prototype.isPrototypeOf.call(AbstractController,clazz)) {
		let instance;
		try {
			instance = Reflect.construct(clazz,additionalArgs);
		}
		catch (ex) {
			Log.error("Error instantiating controller.",ex);
			throw ex;
		}
		if (!(instance instanceof AbstractController)) {
			Log.error("Loaded controller does not extend AbstractController "+filename);
			throw new Error("Loaded controller does not extend AbstractController "+filename);
		}

		if (this.config.informative) Log.info("Loaded controller from "+filename+".");
		_routeController.call(this,route,instance);
	}
	else if (clazz instanceof AbstractController) {
		if (this.config.informative) Log.info("Loaded controller from "+filename+".");
		_routeController.call(this,route,clazz);
	}
	else {
		Log.error("Loaded controller does not extend AbstractController "+filename);
github awesomeeng / awesome-server / src / http2 / HTTP2Server.js View on Github external
server.on("error",(err)=>{
					Log.error("Error on HTTP/2 Server on "+hostname+":"+port+":",err);
				});
github awesomeeng / awesome-server / src / http2 / HTTP2Server.js View on Github external
static resolveCertConfig(value,type="certificate",informative=true) {
		if (value && typeof value==="string" && !value.startsWith("----")) {
			let filename = Path.resolve(process.cwd(),value);
			if (informative) Log.info("Loading "+type+" from "+filename+".");

			if (AwesomeUtils.FS.existsSync(filename)) {
				try {
					let pfx = FS.readFileSync(filename);
					if (!pfx) throw new Error(type+" file empty: "+filename+".");
					value = pfx;
				}
				catch (ex) {
					Log.error("Error reading "+type+" from "+filename+".",ex);
				}
			}
			else {
				Log.error(type+" file not found: "+filename+".");
			}
		}
		else if (value) {
			if (informative) Log.info("Using passed contents for "+type+" value.");
		}

		return value;
	}
}
github awesomeeng / awesome-server / src / AwesomeServer.js View on Github external
const _routeFile = function routeControllerFile(route,filename,additionalArgs=[]) {
	let clazz;
	try {
		clazz = AwesomeUtils.Module.require(filename);
	}
	catch (ex) {
		Log.error("Error loading controller "+filename,ex);
		throw ex;
	}

	if (!clazz) {
		Log.error("Loaded controller not found "+filename);
		throw new Error("Loaded controller not found "+filename);
	}
	else if (clazz instanceof Function && Object.prototype.isPrototypeOf.call(AbstractController,clazz)) {
		let instance;
		try {
			instance = Reflect.construct(clazz,additionalArgs);
		}
		catch (ex) {
			Log.error("Error instantiating controller.",ex);
			throw ex;
		}
github awesomeeng / awesome-server / src / https / HTTPSServer.js View on Github external
if (value && typeof value==="string" && !value.startsWith("----")) {
			let filename = Path.resolve(process.cwd(),value);
			if (informative) Log.info("Loading "+type+" from "+filename+".");

			if (AwesomeUtils.FS.existsSync(filename)) {
				try {
					let pfx = FS.readFileSync(filename);
					if (!pfx) throw new Error(type+" file empty: "+filename+".");
					value = pfx;
				}
				catch (ex) {
					Log.error("Error reading "+type+" from "+filename+".",ex);
				}
			}
			else {
				Log.error(type+" file not found: "+filename+".");
			}
		}
		else if (value) {
			if (informative) Log.info("Using passed contents for "+type+" value.");
		}

		return value;
	}
}
github awesomeeng / awesome-server / src / AwesomeServer.js View on Github external
const nextRoute = async function nextRoute() {
					try {
						if (response.finished) return resolve();

						let route = routes.shift();
						if (!route) return resolve();

						let pathOrParams = route.path;
						if (route.result && route.result!==true) pathOrParams = route.result;
						let p = route.router.call(this,pathOrParams,request,response);
						if (p instanceof Promise) await p;

						setImmediate(nextRoute);
					}
					catch (ex) {
						Log.error("Error in routing for "+url+".",ex);
						return reject(ex);
					}
				};
github awesomeeng / awesome-server / src / http2 / HTTP2Server.js View on Github external
if (value && typeof value==="string" && !value.startsWith("----")) {
			let filename = Path.resolve(process.cwd(),value);
			if (informative) Log.info("Loading "+type+" from "+filename+".");

			if (AwesomeUtils.FS.existsSync(filename)) {
				try {
					let pfx = FS.readFileSync(filename);
					if (!pfx) throw new Error(type+" file empty: "+filename+".");
					value = pfx;
				}
				catch (ex) {
					Log.error("Error reading "+type+" from "+filename+".",ex);
				}
			}
			else {
				Log.error(type+" file not found: "+filename+".");
			}
		}
		else if (value) {
			if (informative) Log.info("Using passed contents for "+type+" value.");
		}

		return value;
	}
}

@awesomeeng/awesome-log

AwesomeLog is a Log System for enterprise nodejs applications. It provides a basic out of the box logging solution that is ready to go with zero configuration but also gives you a highly configurable logging solution that with the power to do your logging

MIT
Latest version published 2 years ago

Package Health Score

45 / 100
Full package analysis