Skip to content

Commit 16c8b7f

Browse files
committed
add log stub
1 parent dc9da7b commit 16c8b7f

File tree

4 files changed

+85
-0
lines changed

4 files changed

+85
-0
lines changed

.editorconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
end_of_line = lf
9+
insert_final_newline = true
10+
11+
# Matches multiple files with brace expansion notation
12+
# Set default charset
13+
[*.{js,css,html,less,jade}]
14+
charset = utf-8
15+
16+
# 2 space indentation
17+
[*.{js,css,html,less,jade}]
18+
indent_style = space
19+
indent_size = 2

index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
3+
Object.assign(module.exports, {
4+
log: require('./src/log')
5+
});

package.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "@rightech/utils",
3+
"version": "0.1.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/Rightech/node-utils.git"
12+
},
13+
"author": "",
14+
"license": "Apache-2.0",
15+
"bugs": {
16+
"url": "https://github.com/Rightech/node-utils/issues"
17+
},
18+
"homepage": "https://github.com/Rightech/node-utils#readme",
19+
"dependencies": {
20+
"colors": "^1.3.3"
21+
}
22+
}

src/log.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
const colors = require('colors/safe');
2+
3+
const LEVELS = Object.freeze({
4+
NONE: 0,
5+
ERROR: 1,
6+
WARN: 2,
7+
INFO: 3,
8+
DEBUG: 4
9+
});
10+
11+
const COLORS = Object.freeze({
12+
1: 'red',
13+
2: 'yellow',
14+
3: 'green',
15+
4: 'white'
16+
});
17+
18+
const FORMAT = Object.freeze({
19+
ascii: 'ascii',
20+
text: 'text',
21+
json: 'json'
22+
});
23+
24+
function getDefaultOptions() {
25+
return {
26+
level: LEVELS.INFO,
27+
width: {
28+
category: 40
29+
}
30+
};
31+
}
32+
33+
34+
module.exports = {
35+
LEVELS,
36+
COLORS,
37+
FORMAT
38+
39+
}

0 commit comments

Comments
 (0)