Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node hello world #60

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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/
24 changes: 24 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
var _ = require('lodash');
const chalk = require('chalk');
var logger = require('./lib/logger');
var logs = require('./data/logs');

logger.info('Logged at info level');
logger.warning('logged at warning level');
logger.error('logged at error level');


_.each(logs, function(current){
let level = current.level;
let message = current.message;
switch (level) {
case 'error': logger.error(message);
break;
case 'warning': logger.warning(message);
break;
case 'info': logger.info(message);
break;

}

});
19 changes: 19 additions & 0 deletions lib/logger.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const chalk = require('chalk');

var logger = {
'log' : function (message, level){
var message = message;
var level = level;
},
'info' : function (message){
console.log(chalk.blue(message));
},
'warning' : function (message){
console.log(chalk.yellow(message));
},
'error' : function (message){
console.log(chalk.red(message));
}
};

module.exports = logger;
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": "intro",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/BrianCarroll112/assignment_node_hello_world.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/BrianCarroll112/assignment_node_hello_world/issues"
},
"homepage": "https://github.com/BrianCarroll112/assignment_node_hello_world#readme",
"dependencies": {
"chalk": "^2.1.0",
"lodash": "^4.17.4"
}
}