Skip to content

Commit

Permalink
use child loggers in services for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
wheelsandcogs committed Sep 11, 2024
1 parent 9f855e1 commit 68410fe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/controllers/blob-storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import {
StorageSharedKeyCredential
} from '@azure/storage-blob';

import { logger } from '../utils/logger';
import { logger as parentLogger } from '../utils/logger';

const logger = parentLogger.child({ module: 'BlobStorageService' });

const accountName = process.env.AZURE_BLOB_STORAGE_ACCOUNT_NAME || 'your-storage-account-name';
const accountKey = process.env.AZURE_BLOB_STORAGE_ACCOUNT_KEY || 'your-storage';
Expand Down
3 changes: 2 additions & 1 deletion src/controllers/csv-processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Readable } from 'stream';
import { parse } from 'csv';

import { i18next, ENGLISH, WELSH } from '../middleware/translation';
import { logger } from '../utils/logger';
import { logger as parentLogger } from '../utils/logger';
import { DatasetDTO, ImportDTO } from '../dtos/dataset-dto';
import { Error } from '../dtos/error';
import { ViewStream, ViewDTO, ViewErrDTO } from '../dtos/view-dto';
Expand All @@ -19,6 +19,7 @@ export const MIN_PAGE_SIZE = 5;
export const DEFAULT_PAGE_SIZE = 100;

const t = i18next.t;
const logger = parentLogger.child({ module: 'CSVProcessor' });

function hashReadableStream(stream: Readable, algorithm: string = 'sha256'): Promise<string> {
return new Promise((resolve, reject) => {
Expand Down

0 comments on commit 68410fe

Please sign in to comment.