diff options
| author | cjd24 | 2018-04-26 03:13:52 +0100 |
|---|---|---|
| committer | cjd24 | 2018-04-26 03:13:52 +0100 |
| commit | 60576c0b58907d48cffcb79ec023e7afaa5a509b (patch) | |
| tree | 5a28023c784dd4271e699db50bdc2f021d59f9d8 /src/logger.ts | |
| parent | small fixes of fs.unlink and paths passed to c (diff) | |
| download | medicine-60576c0b58907d48cffcb79ec023e7afaa5a509b.tar.gz medicine-60576c0b58907d48cffcb79ec023e7afaa5a509b.zip | |
Fixing the threading issue with vips, should be ready for server deployment
Diffstat (limited to 'src/logger.ts')
| -rw-r--r-- | src/logger.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/logger.ts b/src/logger.ts index aa8192c..bed8f72 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -2,9 +2,20 @@ import * as colors from 'colors/safe'; import * as winston from 'winston'; +import { profiler } from './profiler' import { logPath } from './files'; import { QueryOptions } from 'sequelize'; +const dbQuery = profiler.meter({ + name: "Database Requests Per Minute", + samples: 60, + timeframe: 60 +}) +const dbTime = profiler.histogram({ + name: "Time to Serve DB requests (ms)", + measurement: "mean", + agg_type: "avg" +}) type Colour = (s: string) => string; @@ -388,6 +399,8 @@ export const logger: Logger = setDefaults({ user: '_BE4_system', component: 'cor export const logQuery: (query: string, duration: string) => void = ( query: string, duration: string ): void => { + dbQuery.mark(); + dbTime.update(Number(duration)); queryLogger.info(query, { duration }); |
