Skip to content

Commit

Permalink
Non-critical improvements (#62)
Browse files Browse the repository at this point in the history
* Log data blob type and id on version conflict

* Use a different color for debug logs

* Add another WORM-1 UID mapping
  • Loading branch information
nicou authored Jun 30, 2024
1 parent 41a0fb8 commit 733e0b8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions db/redux/misc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ const blobs: unknown[] = [
'0410948A2A6280': 'JW2888',
'040C948A2A6280': 'VE-342',
'0408938A2A6280': 'WORM-1',
'0489938A2A6280': 'WORM-1',
},
},
{
Expand Down
13 changes: 12 additions & 1 deletion src/logger.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
import { Request, Response, NextFunction } from 'express';
import logger from 'signale';
import { Signale } from 'signale';

const logger = new Signale({
types: {
// Override the default debug logger to not be so intimidating
debug: {
badge: 'i',
color: 'cyan',
label: 'debug',
},
},
});

const loggerMiddleware = (req: Request, res: Response, next: NextFunction) => {
next();
Expand Down
2 changes: 1 addition & 1 deletion src/routes/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function setData(dataType, dataId, data, force = false) {
if (!force) {
const oldData = getData(dataType, dataId);
if (oldData.version && oldData.version !== data.version) {
throw new httpErrors.Conflict(`Wrong version number, provided '${data.version}', expected '${oldData.version}'`);
throw new httpErrors.Conflict(`Wrong version number for ${dataType}/${dataId}, provided '${data.version}', expected '${oldData.version}'`);
}
}

Expand Down

0 comments on commit 733e0b8

Please sign in to comment.