Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Commit

Permalink
Merge pull request #547 from roemhildtg/feat-enketo-debugger-namespace
Browse files Browse the repository at this point in the history
feat(app): add enketo namespace to all debug statements
  • Loading branch information
eyelidlessness authored May 5, 2023
2 parents c9e1aab + 1c0ea51 commit a3b61af
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/controllers/media-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const request = require('request');
const express = require('express');

const router = express.Router();
const debug = require('debug')('media-controller');
const debug = require('debug')('enketo:media-controller');
const {
RequestFilteringHttpAgent,
RequestFilteringHttpsAgent,
Expand Down
2 changes: 1 addition & 1 deletion app/lib/communicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const request = require('request');
const { Auth } = require('request/lib/auth');
const TError = require('./custom-error').TranslatedError;
const config = require('../models/config-model').server;
const debug = require('debug')('openrosa-communicator');
const debug = require('debug')('enketo:openrosa-communicator');
const Xml2Js = require('xml2js');

const parser = new Xml2Js.Parser();
Expand Down
2 changes: 1 addition & 1 deletion app/models/cache-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const utils = require('../lib/utils');

const prefix = 'ca:';
const expiry = 30 * 24 * 60 * 60;
const debug = require('debug')('cache-model');
const debug = require('debug')('enketo:cache-model');

const clientGet = promisify(cacheClient.get).bind(cacheClient);
const clientSet = promisify(cacheClient.set).bind(cacheClient);
Expand Down
2 changes: 1 addition & 1 deletion app/models/survey-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const TError = require('../lib/custom-error').TranslatedError;
const config = require('./config-model').server;

const pending = {};
const debug = require('debug')('survey-model');
const debug = require('debug')('enketo:survey-model');

/**
* @typedef {import('./account-model').AccountObj} AccountObj
Expand Down
2 changes: 1 addition & 1 deletion config/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const errorHandler = require('../app/controllers/error-handler');

const controllersPath = path.join(__dirname, '../app/controllers');
const app = express();
const debug = require('debug')('express');
const debug = require('debug')('enketo:express');
const config = require('../app/models/config-model');

// general
Expand Down
8 changes: 8 additions & 0 deletions tutorials/00-getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,11 @@ To configure your own custom external authentication also see [this document](ht
Run with `npm start` from project root.

You can now check that the app is running by going to e.g. http://localhost:8005 (depending on your server and port set in config/config.json or the port forwarding set up in Vagrant (default is 8006))

### How to enable debug logs

Enketo uses the npm `debug` module. All debug statements are prefixed with `enketo:` and will not appear unless the environment variable is set. To enable debugging logs for enketo specifically, set `DEBUG` as follows:

```bash
export DEBUG=enketo*
```

0 comments on commit a3b61af

Please sign in to comment.