fix: re-enable logging only for dev mode

This commit is contained in:
Julian Lam
2024-10-12 22:49:24 -04:00
parent 9062691aa2
commit a226ee9e91
7 changed files with 45 additions and 41 deletions

View File

@@ -1,7 +1,9 @@
'use strict';
const { generateKeyPairSync } = require('crypto');
const process = require('process');
const nconf = require('nconf');
const winston = require('winston');
const validator = require('validator');
const cheerio = require('cheerio');
const crypto = require('crypto');
@@ -25,6 +27,12 @@ const sha256 = payload => crypto.createHash('sha256').update(payload).digest('he
const Helpers = module.exports;
Helpers.log = (message) => {
if (process.env.NODE_ENV === 'development') {
winston.verbose(message);
}
};
Helpers.isUri = (value) => {
if (typeof value !== 'string') {
value = String(value);
@@ -106,7 +114,7 @@ Helpers.query = async (id) => {
};
Helpers.generateKeys = async (type, id) => {
// winston.verbose(`[activitypub] Generating RSA key-pair for ${type} ${id}`);
activitypub.helpers.log(`[activitypub] Generating RSA key-pair for ${type} ${id}`);
const {
publicKey,
privateKey,