• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

GrottoCenter / grottocenter-api / 19671332439

25 Nov 2025 01:33PM UTC coverage: 85.128% (+38.8%) from 46.323%
19671332439

push

github

vmarseguerra
chore(logging): add trace-id capability. Logs requests when a 5xx is returned

2441 of 3029 branches covered (80.59%)

Branch coverage included in aggregate %.

34 of 39 new or added lines in 4 files covered. (87.18%)

72 existing lines in 17 files now uncovered.

5281 of 6042 relevant lines covered (87.4%)

21.56 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.67
/api/utils/logger.js
1
const { AsyncLocalStorage } = require('async_hooks');
1✔
2

3
const asyncLocalStorage = new AsyncLocalStorage();
1✔
4

5
const getTraceId = () => asyncLocalStorage.getStore()?.traceId || 'no-trace';
3✔
6

7
const patchSailsLog = () => {
1✔
NEW
8
  const originalMethods = {
×
9
    info: sails.log.info,
10
    error: sails.log.error,
11
    warn: sails.log.warn,
12
    debug: sails.log.debug,
13
    verbose: sails.log.verbose,
14
  };
15

NEW
16
  Object.keys(originalMethods).forEach((level) => {
×
NEW
17
    sails.log[level] = (...args) => {
×
NEW
18
      originalMethods[level](`[${getTraceId()}]`, ...args);
×
19
    };
20
  });
21
};
22

23
module.exports = {
1✔
24
  getTraceId,
25
  run: (traceId, callback) => asyncLocalStorage.run({ traceId }, callback),
922✔
26
  patchSailsLog,
27
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc