Skip to content

Commit 4072734

Browse files
committed
Adds support for --verbose and verbose option when running ParseServer
1 parent 325d09c commit 4072734

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

src/ParseServer.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import { UserController } from './Controllers/UserController';
4848
import { UsersRouter } from './Routers/UsersRouter';
4949

5050
import ParsePushAdapter from 'parse-server-push-adapter';
51+
import winston from 'winston';
5152
// Mutate the Parse object to add the Cloud Code handlers
5253
addParseCloud();
5354

@@ -115,6 +116,7 @@ class ParseServer {
115116
},
116117
liveQuery = {},
117118
sessionLength = 31536000, // 1 Year in seconds
119+
verbose = false,
118120
}) {
119121
// Initialize the node client SDK automatically
120122
Parse.initialize(appId, javascriptKey || 'unused', masterKey);
@@ -149,6 +151,9 @@ class ParseServer {
149151
}
150152
}
151153

154+
if (verbose || process.env.VERBOSE || process.env.VERBOSE_PARSE_SERVER) {
155+
winston.level = 'silly';
156+
}
152157

153158
const filesControllerAdapter = loadAdapter(filesAdapter, () => {
154159
return new GridStoreAdapter(databaseURI);

src/cli/cli-definitions.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,5 +170,9 @@ export default {
170170
env: "PARSE_SERVER_SESSION_LENGTH",
171171
help: "Session duration, defaults to 1 year",
172172
action: numberParser("sessionLength")
173+
},
174+
"verbose": {
175+
env: "VERBOSE",
176+
help: "Set the logging to verbose"
173177
}
174178
};

src/index.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@ import S3Adapter from 'parse-server-s3-adapter'
44
import FileSystemAdapter from 'parse-server-fs-adapter'
55
import { useExternal } from './deprecated'
66

7-
if (process.env.VERBOSE || process.env.VERBOSE_PARSE_SERVER) {
8-
winston.level = 'silly';
9-
}
10-
11-
if (process.env.DEBUG || process.env.DEBUG_PARSE_SERVER) {
12-
winston.level = 'debug';
13-
}
14-
157
// Factory function
168
let _ParseServer = function(options) {
179
let server = new ParseServer(options);

0 commit comments

Comments
 (0)