How to use the @awesomeeng/awesome-log.info 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-log / examples / ExampleCustomWriter / ExampleCustomWriter.js View on Github external
// configuration property to enable it.
Log.init({
	writers: [{
		name: "my-writer",
		type: "my-example-writer"
	}]
});

// Then everything is exactly the same as basic usage.
//
// Start the log...
Log.start();

// Log something out to it...
// See the MyExampleCustomWriter.js file for implementation details.
Log.info("This is an example log message.");

// stop when we are done.
Log.stop();
github awesomeeng / awesome-log / examples / ExampleCustomFormatter / ExampleCustomFormatter.js View on Github external
name: "console",
		type: "default",
		levels: "*",
		formatter: "my-example-formatter",
		options: {}
	}]
});

// Then everything is exactly the same as basic usage.
//
// Start the log...
Log.start();

// Log something out to it...
// See the MyExampleCustomWriter.js file for implementation details.
Log.info("This is an example log message.");

// stop when we are done.
Log.stop();
github awesomeeng / awesome-server / src / AwesomeServer.js View on Github external
&& (!handler || route.handler===handler);
	});

	// remove them
	this[$ROUTES] = this[$ROUTES].filter((route)=>{
		return matching.indexOf(route)<0;
	});

	// cleanup child routes if any
	matching.forEach((route)=>{
		(route.children||[]).forEach((child)=>{
			_unroute.call(this,child.method,child.path,child.handler);
		});
	});

	if (matching.length>0 && this.config.informative) Log.info("Removed route "+method+" "+path.toString());

	return matching.length>0;
};
github awesomeeng / awesome-server / src / https / HTTPSServer.js View on Github external
server.close((err)=>{
					if (err) {
						Log.error("Error stopping HTTPS server on "+hostname+":"+port+".",err);
						this[$RUNNING] = false;
						this[$SERVER] = null;
						reject(err);
					}
					else {
						if (this.config.informative) Log.info("Stopped HTTPS Server on "+hostname+":"+port+"...");
						this[$RUNNING] = false;
						this[$SERVER] = null;
						resolve();
					}
				});
			}
github awesomeeng / awesome-server / src / AwesomeServer.js View on Github external
if (this.config.informative) Log.info("Starting...");

		if (this[$SERVERS].size<1) {
			Log.warn("No servers defined. Nothing to do.");
		}
		else {
			await Promise.all([...this[$SERVERS]].map((server)=>{
				let prom = server.start(this.handler.bind(this));
				if (prom instanceof Promise) return prom;
				return Promise.resolve();
			}));
		}

		this[$RUNNING] = true;

		if (this.config.informative) Log.info("Started.");
	}
github awesomeeng / awesome-server / src / controllers / RedirectController.js View on Github external
async any(path,request,response) {
		Log.info("Redirecting "+(this.temporary?"temporarilly":"permanently")+" to "+this.toPath);
		response.writeHead(this.temporary ? 302 : 301,{
			Location: this.toPath
		});
		await response.end();
	}
}
github awesomeeng / awesome-server / src / http2 / HTTP2Server.js View on Github external
stop() {
		if (!this[$SERVER]) return Promise.resolve();

		let hostname = this.hostname || "localhost";
		let port = this.port || 0;

		if (this.config.informative) Log.info("Stopping HTTP/2 Server on "+hostname+":"+port+"...");
		return new Promise(async (resolve,reject)=>{
			try {
				let server = this[$SERVER];

				await Promise.all(this[$SESSIONS].map((session)=>{
					return new Promise((resolve,reject)=>{
						try {
							session.close(()=>{
								resolve();
							});
						}
						catch (ex) {
							return reject(ex);
						}
					});
				}));
github awesomeeng / awesome-server / src / AwesomeServer.js View on Github external
_routeFile.call(this,route,filename,additionalArgs);
		}
		else {
			throw new Error("Invalid handler, is neither directory or file: "+filename);
		}
	}
	if (!route.routes) throw new Error("Invalid handler.");

	this.unroute(method,path,handler);
	this[$ROUTES].push(route);
	if (parent) {
		parent.children = parent.children || [];
		parent.children.push(route);
	}

	if (this.config.informative) Log.info("Added route "+method+" "+route.matcher.toString());

	return route;
};
github awesomeeng / awesome-server / src / http / HTTPServer.js View on Github external
stop() {
		if (!this[$SERVER]) return Promise.resolve();

		let hostname = this.hostname || "localhost";
		let port = this.port || 0;

		if (this.config.informative) Log.info("Stopping HTTP Server on "+hostname+":"+port+"...");
		return new Promise((resolve,reject)=>{
			try {
				let server = this[$SERVER];
				server.close((err)=>{
					if (err) {
						Log.error("Error stopping HTTP server on "+hostname+":"+port+".",err);
						this[$RUNNING] = false;
						this[$SERVER] = null;
						reject(err);
					}
					else {
						if (this.config.informative) Log.info("Stopped HTTP Server on "+hostname+":"+port+"...");
						this[$RUNNING] = false;
						this[$SERVER] = null;
						resolve();
					}
github awesomeeng / awesome-server / src / AwesomeServer.js View on Github external
async start() {
		if (this.running) return Promise.resolve();

		if (this.config.informative) Log.info("Starting...");

		if (this[$SERVERS].size<1) {
			Log.warn("No servers defined. Nothing to do.");
		}
		else {
			await Promise.all([...this[$SERVERS]].map((server)=>{
				let prom = server.start(this.handler.bind(this));
				if (prom instanceof Promise) return prom;
				return Promise.resolve();
			}));
		}

		this[$RUNNING] = true;

		if (this.config.informative) Log.info("Started.");
	}

@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