Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
persona
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hexang 息壤平台
persona
Commits
28a690fa
Commit
28a690fa
authored
13 years ago
by
Lloyd Hilaiel
Browse files
Options
Downloads
Patches
Plain Diff
local logs should be stored in a directory, make logging stuff create directories as needed
parent
77286282
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+2
-1
2 additions, 1 deletion
.gitignore
libs/configuration.js
+4
-2
4 additions, 2 deletions
libs/configuration.js
libs/logging.js
+14
-1
14 additions, 1 deletion
libs/logging.js
with
20 additions
and
4 deletions
.gitignore
+
2
−
1
View file @
28a690fa
*~
\#*\#
.\#*
node_modules
/node_modules
/var
This diff is collapsed.
Click to expand it.
libs/configuration.js
+
4
−
2
View file @
28a690fa
...
...
@@ -7,7 +7,9 @@
* exports.configure(app);
*/
const
substitution
=
require
(
'
./substitute.js
'
);
const
substitution
=
require
(
'
./substitute.js
'
),
path
=
require
(
'
path
'
);
var
g_config
=
{
};
...
...
@@ -56,7 +58,7 @@ const g_configs = {
port
:
'
10002
'
,
scheme
:
'
http
'
,
use_minified_resources
:
false
,
log_path
:
'
./
'
,
log_path
:
path
.
join
(
__dirname
,
"
..
"
,
"
var
"
,
"
logs
"
)
,
database
:
{
driver
:
"
json
"
}
}
};
...
...
This diff is collapsed.
Click to expand it.
libs/logging.js
+
14
−
1
View file @
28a690fa
const
winston
=
require
(
"
winston
"
),
configuration
=
require
(
"
./configuration
"
),
path
=
require
(
'
path
'
);
path
=
require
(
'
path
'
),
fs
=
require
(
'
fs
'
);
// go through the configuration and determine log location
// for now we only log to one place
...
...
@@ -10,9 +11,21 @@ path = require('path');
var
log_path
=
configuration
.
get
(
'
log_path
'
);
var
LOGGERS
=
[];
// simple inline function for creation of dirs
function
mkdir_p
(
p
)
{
if
(
!
path
.
existsSync
(
p
))
{
mkdir_p
(
path
.
dirname
(
p
));
console
.
log
(
"
mkdir
"
,
p
);
fs
.
mkdirSync
(
p
,
"
0755
"
);
}
}
function
setupLogger
(
category
)
{
if
(
!
log_path
)
return
console
.
log
(
"
no log path! Not logging!
"
);
else
mkdir_p
(
log_path
);
// don't create the logger if it already exists
if
(
LOGGERS
[
category
])
...
...
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