Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
33 changes: 33 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
var _ = require("lodash");
var chalk = require("chalk");
var jsonLogs = require("./data/logs");

console.log(chalk.blue("yay"));

var names = ["bob", "fred", "will"];

_.each(names, function(name){
console.log(chalk.blue(name))
})

console.log()
console.log()
console.log()
console.log()

//warmup end

var logger = require("./lib/logger");
logger.log('info level', 'info')
logger.log('warning level', 'warning')
logger.log('error level', 'error')
console.log();
logger.info("info");
logger.warning("warning");
logger.error("error");

console.log("~~~~~");

_.each(jsonLogs, function(jsonLog){
logger.log(jsonLog.message, jsonLog.level);
})
26 changes: 26 additions & 0 deletions lib/logger.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
var logger = module.exports;
var chalk = require('chalk');



logger.info = function(message){
console.log( chalk.blue(message) );
};


logger.warning = function(message){
console.log( chalk.yellow(message) );
};


logger.error = function(message){
console.log( chalk.red(message) );
};

logger.log = function(message, level){

if (level === "info") { this.info(message) };
if (level === "warning") { this.warning(message) };
if (level === "error") { this.error(message) };

};
23 changes: 23 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "assignment_node_hello_world",
"version": "1.0.0",
"description": "assignment_node_hello_world ===========================",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/kotten1/assignment_node_hello_world.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/kotten1/assignment_node_hello_world/issues"
},
"homepage": "https://github.com/kotten1/assignment_node_hello_world#readme",
"dependencies": {
"chalk": "^2.4.1",
"lodash": "^4.17.10"
}
}