Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace intel with sitespeed.io/log #117

Merged
merged 2 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions server/config/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ database:
password: jhde7gFArda33Saa1!4dd2dagJ
port: 5432

# Configure the log. If you want to log to a file, set full path and name of the file.
# Configure the log.
log:
file: null
verbose: false

# Make sure only users with the correct key can add tests
Expand Down
135 changes: 10 additions & 125 deletions server/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"pug-lint-config-clock": "2.0.0"
},
"dependencies": {
"@sitespeed.io/log": "0.2.2",
"body-parser": "1.20.3",
"bull": "4.16.5",
"compression": "1.7.5",
Expand All @@ -70,7 +71,6 @@
"express": "5.0.1",
"express-beautify": "0.1.3",
"helmet": "8.0.0",
"intel": "1.2.0",
"js-yaml": "4.1.0",
"lodash.get": "4.4.2",
"lodash.merge": "4.6.2",
Expand Down
4 changes: 2 additions & 2 deletions server/src/database/databasehelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import postgrespackage from 'pg';
const { Pool } = postgrespackage;

import nconf from 'nconf';
import log from 'intel';
import { getLogger } from '@sitespeed.io/log';

const logger = log.getLogger('sitespeedio.database.query');
const logger = getLogger('sitespeedio.database.query');

class DatabaseHelper {
constructor() {
Expand Down
6 changes: 3 additions & 3 deletions server/src/database/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import log from 'intel';
import { getLogger } from '@sitespeed.io/log';

import DatabaseHelper from './databasehelper.js';

const logger = log.getLogger('sitespeedio.database');
const logger = getLogger('sitespeedio.database');

const LIMITED_COLUMS =
'id, location, test_type, run_date, browser_name, url, result_url, status, scripting_name, label, slug';
Expand Down Expand Up @@ -61,7 +61,7 @@ export async function saveTest(
* Update the status of the test
*/
export async function updateStatus(id, status) {
log.info('Update %s with %s', id, status);
logger.info('Update %s with %s', id, status);
const update = 'UPDATE sitespeed_io_test_runs SET status = $1 WHERE id = $2';
const values = [status, id];
try {
Expand Down
4 changes: 2 additions & 2 deletions server/src/database/search.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import dayjs from 'dayjs';
import log from 'intel';
import { getLogger } from '@sitespeed.io/log';

import DatabaseHelper from './databasehelper.js';

const logger = log.getLogger('sitespeedio.database.search');
const logger = getLogger('sitespeedio.database.search');

const LIMITED_COLUMS =
'id, location, test_type, run_date, browser_name, url, result_url, status, scripting_name, label, slug';
Expand Down
4 changes: 2 additions & 2 deletions server/src/middleware/errorhandler.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import nconf from 'nconf';
import { getText } from '../util/text.js';

import log from 'intel';
const logger = log.getLogger('sitespeedio.server');
import { getLogger } from '@sitespeed.io/log';
const logger = getLogger('sitespeedio.server');

export const error404 = function (request, response) {
response.status(400);
Expand Down
4 changes: 2 additions & 2 deletions server/src/middleware/validatekey.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import nconf from 'nconf';
import log from 'intel';
const logger = log.getLogger('sitespeedio.server');
import { getLogger } from '@sitespeed.io/log';
const logger = getLogger('sitespeedio.server');
import { getText } from '../util/text.js';

export const validateKey = (request, response, next) => {
Expand Down
4 changes: 2 additions & 2 deletions server/src/middleware/validatequeue.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getDeviceQueue, getExistingQueue } from '../queuehandler.js';
import get from 'lodash.get';
import log from 'intel';
const logger = log.getLogger('sitespeedio.server');
import { getLogger } from '@sitespeed.io/log';
const logger = getLogger('sitespeedio.server');

import { getText } from '../util/text.js';

Expand Down
6 changes: 3 additions & 3 deletions server/src/middleware/validatescripting.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import validator from 'validator';
import log from 'intel';
import { getLogger } from '@sitespeed.io/log';
import nconf from 'nconf';

const { isURL } = validator;
const logger = log.getLogger('sitespeedio.server');
const logger = getLogger('sitespeedio.server');

import { getText } from '../util/text.js';

Expand All @@ -13,7 +13,7 @@ export const validateScripting = (request, response, next) => {
try {
validRegEx = new RegExp(testDomain);
} catch (error) {
log.error('Could not use regular expression', error);
logger.error('Could not use regular expression', error);
request.inputValidationError = getText(
'error.nonmatchingdomain',
'',
Expand Down
6 changes: 3 additions & 3 deletions server/src/middleware/validateurl.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// middleware/validateURL.js
import validator from 'validator';
import log from 'intel';
import { getLogger } from '@sitespeed.io/log';
import nconf from 'nconf';

const { isURL } = validator;

import { getText } from '../util/text.js';

const logger = log.getLogger('sitespeedio.server');
const logger = getLogger('sitespeedio.server');

export const validateURL = (request, response, next) => {
const testDomain = nconf.get('validTestDomains');
Expand Down Expand Up @@ -53,7 +53,7 @@ export const validateURL = (request, response, next) => {
return next();
}
} catch (error) {
log.error('Could not use the regular expression', error);
logger.error('Could not use the regular expression', error);
request.inputValidationError = getText(
'error.nonmatchingdomain',
url,
Expand Down
4 changes: 2 additions & 2 deletions server/src/queuehandler.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import NodeCache from 'node-cache';
const idToQueue = new NodeCache({ stdTTL: 60 * 60, checkperiod: 120 });
import Queue from 'bull';
import log from 'intel';
const logger = log.getLogger('sitespeedio.server');
import { getLogger } from '@sitespeed.io/log';
const logger = getLogger('sitespeedio.server');
const queues = {};
const deviceToQueue = {};
import nconf from 'nconf';
Expand Down
4 changes: 2 additions & 2 deletions server/src/routes/api/api.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Router } from 'express';
import log from 'intel';
import { getLogger } from '@sitespeed.io/log';

import { createRequire } from 'node:module';

Expand All @@ -15,7 +15,7 @@ import { addTestFromAPI } from '../../util/add-test.js';
import { getTestRunners } from '../../testrunners.js';
import { getText } from '../../util/text.js';
import { validateQueue } from '../../middleware/validatequeue.js';
const logger = log.getLogger('sitespeedio.server.api');
const logger = getLogger('sitespeedio.server.api');

const require = createRequire(import.meta.url);
const version = require('../../../package.json').version;
Expand Down
4 changes: 2 additions & 2 deletions server/src/routes/html/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Router } from 'express';
import { createRequire } from 'node:module';

import nconf from 'nconf';
import log from 'intel';
import { getLogger } from '@sitespeed.io/log';

import { getTestRunners } from '../../testrunners.js';
import { addTest } from '../../util/add-test.js';
Expand All @@ -15,7 +15,7 @@ import { validateQueue } from '../../middleware/validatequeue.js';
import { getQueueSize } from '../../queuehandler.js';

export const index = Router();
const logger = log.getLogger('sitespeedio.server');
const logger = getLogger('sitespeedio.server');

const require = createRequire(import.meta.url);
const version = require('../../../package.json').version;
Expand Down
Loading
Loading