Skip to content
Snippets Groups Projects
Commit 8cfc24b9 authored by Austin King's avatar Austin King
Browse files

Adding dev_bid and default_bid which have millisecond resolution. Fixes Issue#1254 and Issue#1255

parent 14ac65bb
No related branches found
No related tags found
No related merge requests found
...@@ -135,7 +135,7 @@ app.use(function(req, resp, next) { ...@@ -135,7 +135,7 @@ app.use(function(req, resp, next) {
var static_root = path.join(__dirname, "..", "resources", "static"); var static_root = path.join(__dirname, "..", "resources", "static");
app.use(cachify.setup(assets(config.get('supported_languages')), app.use(cachify.setup(assets(config.get('supported_languages')),
{ {
prefix: 'v', prefix: 'v',
production: config.get('use_minified_resources'), production: config.get('use_minified_resources'),
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
"database": { "database": {
"driver": "json" "driver": "json"
}, },
"express_log_format": "dev", "express_log_format": "dev_bid",
"email_to_console": true "email_to_console": true
} }
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
"debug_lang": "it-CH", "debug_lang": "it-CH",
// locale directory should be overridden // locale directory should be overridden
"locale_directory": "/home/app/code/locale", "locale_directory": "/home/app/code/locale",
"express_log_format": "default", "express_log_format": "default_bid",
"email_to_console": false, "email_to_console": false,
// var path should be overridded // var path should be overridded
// "var_path": "xxx", // "var_path": "xxx",
......
...@@ -22,6 +22,9 @@ fs = require('fs'), ...@@ -22,6 +22,9 @@ fs = require('fs'),
convict = require('convict'), convict = require('convict'),
cjson = require('cjson'); cjson = require('cjson');
// Side effect - Adds default_bid and dev_bid to express.logger formats
require('./custom_logger');
// verify the proper version of node.js is in use // verify the proper version of node.js is in use
try { try {
var required = 'unknown'; var required = 'unknown';
...@@ -154,7 +157,7 @@ var conf = module.exports = convict({ ...@@ -154,7 +157,7 @@ var conf = module.exports = convict({
debug_lang: 'string = "it-CH"', debug_lang: 'string = "it-CH"',
supported_languages: 'array { string }* = [ "en-US" ]', supported_languages: 'array { string }* = [ "en-US" ]',
locale_directory: 'string = "locale"', locale_directory: 'string = "locale"',
express_log_format: 'string [ "default", "dev" ] = "default"', express_log_format: 'string [ "default_bid", "dev_bid", "default", "dev", "short", "tiny" ] = "default"',
keysigner_url: { keysigner_url: {
format: 'string?', format: 'string?',
env: 'KEYSIGNER_URL' env: 'KEYSIGNER_URL'
......
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Enhances connect logger middleware - custom formats. See lib/configuration for usage.
*
* Note: No exports, ya I feel dirty too.
*/
var logger = require('express').logger;
logger.format('default_bid',
':remote-addr - - :date-millis ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"');
logger.format('dev_bid', ':date-millis :method :url :status :response-time ms');
logger.token('date-millis', function (req) {
var d = req._startTime,
t = '' + d.getTime();
return '[' + d.toUTCString() + ']@' + t.slice(-4);
});
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment