Skip to content

Commit 1cf918a

Browse files
committed
reorder project structure
1 parent c7d4b4e commit 1cf918a

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

models/.gitkeep

Whitespace-only changes.

config/logger.js renamed to utils/logger.js

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,34 @@
22
* Copyright (c) 2016-present, Alejandro Mantilla <@AlejoJamC>.
33
* All rights reserved.
44
*
5-
* This source code is licensed under the BSD-style license found in the
6-
* LICENSE file in the root directory of this source tree or translated in the assets folder.
5+
* This source code is licensed under the MIT license found in the LICENSE
6+
* file in the root directory of this source tree or translated in the assets folder.
77
*/
88

99
/**
1010
* Module dependencies
1111
*/
12-
13-
// TODO: evitar error si la carpeta logs no existe, crear la carpeta por codigo
1412
var fs = require('fs'),
1513
path = require('path'),
1614
winston = require('winston'),
1715

18-
filedebug = path.join(__dirname,'..','logs','debug.log'),
19-
filerror = path.join(__dirname,'..','logs','error.log'),
20-
fileinfo = path.join(__dirname,'..','logs','info.log');
16+
folderlogs = path.join(__dirname,'..','logs'),
17+
18+
filedebug = path.join(folderlogs,'debug.log'),
19+
filerror = path.join(folderlogs,'error.log'),
20+
fileinfo = path.join(folderlogs,'info.log');
2121

22-
// Activate winston emitter
22+
/**
23+
* Check if folder logs exists.
24+
*/
25+
if(!(fs.existsSync(folderlogs))){
26+
fs.mkdirSync(folderlogs);
27+
}
28+
29+
// Activate winston emitter.
2330
winston.emitErrs = true;
2431

25-
// Remove the file, ignoring any errors
32+
// Remove the file, ignoring any errors.
2633
try {
2734
fs.unlinkSync(fileinfo);
2835
fs.unlinkSync(filedebug);
@@ -70,7 +77,6 @@ var logger = new (winston.Logger)({
7077
});
7178

7279
/**
73-
* Export winston logger coniguration
80+
* Export winston logger coniguration.
7481
*/
75-
76-
module.exports.Logger = logger;
82+
module.exports.logger = logger;

0 commit comments

Comments
 (0)