Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
simcaq-node
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
simcaq
simcaq-node
Commits
15d4ec57
There was a problem fetching the pipeline summary.
Commit
15d4ec57
authored
8 years ago
by
Vytor Calixto
Browse files
Options
Downloads
Plain Diff
Merge branch 'jsdoc' of gitlab.c3sl.ufpr.br:simcaq/simcaq-node into development
Conflicts: gulpfile.babel.js
parents
9c48e5c5
adaecc34
No related branches found
No related tags found
No related merge requests found
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gulpfile.babel.js
+22
-9
22 additions, 9 deletions
gulpfile.babel.js
src/libs/log.js
+19
-4
19 additions, 4 deletions
src/libs/log.js
with
41 additions
and
13 deletions
gulpfile.babel.js
+
22
−
9
View file @
15d4ec57
const
fs
=
require
(
'
fs
'
);
const
gulp
=
require
(
'
gulp
'
);
const
gulp
=
require
(
'
gulp
'
);
const
babel
=
require
(
'
gulp-babel
'
);
const
babel
=
require
(
'
gulp-babel
'
);
...
@@ -14,10 +16,23 @@ const jsdoc = require('gulp-jsdoc3');
...
@@ -14,10 +16,23 @@ const jsdoc = require('gulp-jsdoc3');
const
cache
=
new
Cache
();
const
cache
=
new
Cache
();
function
createLogDir
()
{
const
logDirPath
=
'
build/logs
'
;
fs
.
access
(
logDirPath
,
fs
.
F_OK
,
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`Logs directory not found, creating it.`
);
fs
.
mkdir
(
logDirPath
,
0o700
,
(
dirErr
)
=>
{
console
.
error
(
`Failed to create logs directory.\n\tError:
${
dirErr
}
`
);
});
}
});
}
/**
/**
* Compile source files
* Compile source files
*/
*/
function
compile
()
{
gulp
.
task
(
'
compile
'
,
()
=>
{
createLogDir
();
// run ESLint
// run ESLint
gulp
.
src
(
'
src/**/*.js
'
)
gulp
.
src
(
'
src/**/*.js
'
)
.
pipe
(
eslint
())
.
pipe
(
eslint
())
...
@@ -33,10 +48,9 @@ function compile() {
...
@@ -33,10 +48,9 @@ function compile() {
// copy configuration file to build directory
// copy configuration file to build directory
gulp
.
src
(
'
config.json
'
)
gulp
.
src
(
'
config.json
'
)
.
pipe
(
gulp
.
dest
(
'
build
'
));
.
pipe
(
gulp
.
dest
(
'
build
'
));
});
}
gulp
.
task
(
'
build
'
,
[
'
compile
'
]);
gulp
.
task
(
'
build
'
,
compile
);
gulp
.
task
(
'
doc
'
,
(
cb
)
=>
{
gulp
.
task
(
'
doc
'
,
(
cb
)
=>
{
let
config
=
require
(
'
./jsdoc.json
'
);
let
config
=
require
(
'
./jsdoc.json
'
);
...
@@ -44,7 +58,7 @@ gulp.task('doc', (cb) => {
...
@@ -44,7 +58,7 @@ gulp.task('doc', (cb) => {
.
pipe
(
jsdoc
(
config
,
cb
));
.
pipe
(
jsdoc
(
config
,
cb
));
});
});
gulp
.
task
(
'
test
'
,
()
=>
{
gulp
.
task
(
'
test
'
,
[
'
build
'
],
()
=>
{
gulp
.
src
(
'
test/test.js
'
,
{
read
:
false
})
gulp
.
src
(
'
test/test.js
'
,
{
read
:
false
})
.
pipe
(
mocha
())
.
pipe
(
mocha
())
.
once
(
'
error
'
,
()
=>
{
.
once
(
'
error
'
,
()
=>
{
...
@@ -55,13 +69,12 @@ gulp.task('test', () => {
...
@@ -55,13 +69,12 @@ gulp.task('test', () => {
});
});
});
});
gulp
.
task
(
'
watch
'
,
[],
()
=>
{
gulp
.
task
(
'
watch
'
,
[
'
compile
'
],
()
=>
{
console
.
log
(
'
Watching source directory for changes
'
);
console
.
log
(
'
Watching source directory for changes
'
);
compile
();
gulp
.
watch
(
'
src/**/*.js
'
).
on
(
'
change
'
,
()
=>
{
gulp
.
watch
(
'
src/**/*.js
'
).
on
(
'
change
'
,
()
=>
{
console
.
log
(
'
Recompiling source
'
);
console
.
log
(
'
Recompiling source
'
);
compile
(
);
gulp
.
start
(
'
compile
'
);
console
.
log
(
'
Source recompilation done
'
)
console
.
log
(
'
Source recompilation done
'
)
;
});
});
});
});
...
...
This diff is collapsed.
Click to expand it.
src/libs/log.js
+
19
−
4
View file @
15d4ec57
...
@@ -10,16 +10,29 @@ function getFilePath(module) {
...
@@ -10,16 +10,29 @@ function getFilePath(module) {
}
}
function
logger
(
module
)
{
function
logger
(
module
)
{
const
logPath
=
`
${
process
.
cwd
()}
/logs`
;
const
maxLogFiles
=
5
;
const
maxLogSize
=
5242880
;
const
log
=
new
winston
.
Logger
({
const
log
=
new
winston
.
Logger
({
transports
:
[
transports
:
[
new
winston
.
transports
.
File
({
new
winston
.
transports
.
File
({
name
:
'
info-log
'
,
name
:
'
info-log
'
,
level
:
'
info
'
,
level
:
'
info
'
,
filename
:
`
${
process
.
cwd
()}
/logs/all
.log`
,
filename
:
`
${
logPath
}
/simcaq-info
.log`
,
handleException
:
true
,
handleException
:
true
,
json
:
false
,
json
:
false
,
maxSize
:
5242880
,
// 5MB
maxSize
:
maxLogSize
,
// 5MB
maxFiles
:
2
,
maxFiles
:
maxLogFiles
,
colorize
:
false
,
}),
new
winston
.
transports
.
File
({
name
:
'
error-log
'
,
level
:
'
error
'
,
filename
:
`
${
logPath
}
/simcaq-error.log`
,
handleException
:
true
,
json
:
false
,
maxSize
:
maxLogSize
,
// 5MB
maxFiles
:
maxLogFiles
,
colorize
:
false
,
colorize
:
false
,
}),
}),
new
winston
.
transports
.
Console
({
new
winston
.
transports
.
Console
({
...
@@ -33,7 +46,9 @@ function logger(module) {
...
@@ -33,7 +46,9 @@ function logger(module) {
],
],
exitOnError
:
false
,
exitOnError
:
false
,
});
});
if
(
!
config
.
get
(
'
debug
'
))
{
const
debugMode
=
(
typeof
config
.
get
(
'
debug
'
)
===
'
undefined
'
)
?
config
.
get
(
'
debug
'
)
:
false
;
if
(
!
debugMode
)
{
log
.
remove
(
'
debug-log
'
);
log
.
remove
(
'
debug-log
'
);
}
}
return
log
;
return
log
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment