underscore_to_camelCase
Pointy haired boss decided we need to switch to camelCase. Let's get this over with.
Start file
log(req, res, next) {
try {
let ratio = this.config.get("HEADER_LOG_FREQ", 0.05);
if (Math.random() < ratio) {
this.arrange_headers(req, res).then(this.write_log);
}
let safe_path = this.safe_graphite_path(req.path);
this.stats.increment("web.endpoint." + safe_path, 1, 0.05);
if (req.headers && req.headers["x-forwarded-proto"]) {
this.stats.increment("web.protocol." + req.headers["x-forwarded-proto"], 1, 0.05);
}
} catch (error) {
log.warning(error, "Failed to log headers");
res.status(500).send("its_not_you_its_me");
} finally {
next();
}
}
End file
log(req, res, next) {
try {
let ratio = this.config.get("HEADER_LOG_FREQ", 0.05);
if (Math.random() < ratio) {
this.arrangeHeaders(req, res).then(this.writeLog);
}
let safePath = this.safeGraphitePath(req.path);
this.stats.increment("web.endpoint." + safePath, 1, 0.05);
if (req.headers && req.headers["x-forwarded-proto"]) {
this.stats.increment("web.protocol." + req.headers["x-forwarded-proto"], 1, 0.05);
}
} catch (error) {
log.warning(error, "Failed to log headers");
res.status(500).send("its_not_you_its_me");
} finally {
next();
}
}
View Diff
5c5
< this.arrange_headers(req, res).then(this.write_log);
---
> this.arrangeHeaders(req, res).then(this.writeLog);
7,8c7,8
< let safe_path = this.safe_graphite_path(req.path);
< this.stats.increment("web.endpoint." + safe_path, 1, 0.05);
---
> let safePath = this.safeGraphitePath(req.path);
> this.stats.increment("web.endpoint." + safePath, 1, 0.05);
Solutions by @clupasq:
Unlock 1 remaining solutions by signing in and submitting your own entry