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

Refactoring logging to be at top level (#790) #894

Merged
merged 1 commit into from
Feb 11, 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
2 changes: 1 addition & 1 deletion cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import path from 'path';
import { mkdirp } from 'mkdirp';
import { writeFileSync } from 'fs';
import { version } from '../package.json';
import { initLogger } from '@finos/calm-shared/commands/helper';
import { initLogger } from '@finos/calm-shared/logger';
import { startServer } from './server/cli-server';

const FORMAT_OPTION = '-f, --format <format>';
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

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

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { SchemaDirectory } from '../../../schema-directory';
import { instantiateGenericObject } from './instantiate';

jest.mock('../../helper', () => {
jest.mock('../../../logger', () => {
return {
initLogger: () => {
return {
Expand Down
2 changes: 1 addition & 1 deletion shared/src/commands/generate/components/instantiate.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Logger } from 'winston';
import { initLogger } from '../../helper.js';
import { initLogger } from '../../../logger.js';
import { SchemaDirectory } from '../../../schema-directory.js';
import { appendPath, mergeSchemas, renderPath } from '../../../util.js';
import { getConstValue, getEnumPlaceholder, getPropertyValue } from './property.js';
Expand Down
2 changes: 1 addition & 1 deletion shared/src/commands/generate/components/metadata.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SchemaDirectory } from '../../../schema-directory';
import { instantiateAllMetadata, instantiateMetadataObject } from './metadata';

jest.mock('../../helper', () => {
jest.mock('../../../logger', () => {
return {
initLogger: () => {
return {
Expand Down
2 changes: 1 addition & 1 deletion shared/src/commands/generate/components/metadata.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { initLogger } from '../../helper.js';
import { initLogger } from '../../../logger.js';
import { SchemaDirectory } from '../../../schema-directory.js';
import { appendPath } from '../../../util.js';
import { instantiateGenericObject } from './instantiate.js';
Expand Down
2 changes: 1 addition & 1 deletion shared/src/commands/generate/components/node.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { SchemaDirectory } from '../../../schema-directory';
import { instantiateNodes } from './node';

jest.mock('../../helper', () => {
jest.mock('../../../logger', () => {
return {
initLogger: () => {
return {
Expand Down
2 changes: 1 addition & 1 deletion shared/src/commands/generate/components/node.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-explicit-any */

import { initLogger } from '../../helper.js';
import { initLogger } from '../../../logger.js';
import { SchemaDirectory } from '../../../schema-directory.js';
import { appendPath } from '../../../util.js';
import { instantiateGenericObject } from './instantiate.js';
Expand Down
2 changes: 1 addition & 1 deletion shared/src/commands/generate/components/property.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { getConstValue, getEnumPlaceholder, getPropertyValue } from './property';

jest.mock('../../helper', () => {
jest.mock('../../../logger', () => {
return {
initLogger: () => {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { SchemaDirectory } from '../../../schema-directory';
import { instantiateRelationships } from './relationship';

jest.mock('../../helper', () => {
jest.mock('../../../logger', () => {
return {
initLogger: () => {
return {
Expand Down
2 changes: 1 addition & 1 deletion shared/src/commands/generate/components/relationship.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-explicit-any */

import { initLogger } from '../../helper.js';
import { initLogger } from '../../../logger.js';
import { SchemaDirectory } from '../../../schema-directory.js';
import { appendPath } from '../../../util.js';
import { instantiateGenericObject } from './instantiate.js';
Expand Down
2 changes: 1 addition & 1 deletion shared/src/commands/generate/generate.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jest.mock('../../consts', () => ({
get CALM_META_SCHEMA_DIRECTORY() { return 'test_fixtures/calm'; }
}));

jest.mock('../helper', () => {
jest.mock('../../logger', () => {
return {
initLogger: () => {
return {
Expand Down
2 changes: 1 addition & 1 deletion shared/src/commands/generate/generate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { tmpdir } from 'node:os';
import { existsSync, mkdtempSync, readFileSync, rmSync } from 'node:fs';
import path from 'node:path';

jest.mock('../helper', () => {
jest.mock('../../logger', () => {
return {
initLogger: () => {
return {
Expand Down
2 changes: 1 addition & 1 deletion shared/src/commands/generate/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as path from 'node:path';
import {mkdirp} from 'mkdirp';

import * as winston from 'winston';
import {initLogger} from '../helper.js';
import {initLogger} from '../../logger.js';
import {CALMArchitecture} from '../../types.js';
import {SchemaDirectory} from '../../schema-directory.js';
import {instantiateNodes} from './components/node.js';
Expand Down
2 changes: 1 addition & 1 deletion shared/src/commands/validate/validate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jest.mock('@stoplight/spectral-core', () => {
};
});

jest.mock('../helper.js', () => {
jest.mock('../../logger.js', () => {
return {
initLogger: () => {
return {
Expand Down
2 changes: 1 addition & 1 deletion shared/src/commands/validate/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import validationRulesForPattern from '../../spectral/rules-pattern';
import validationRulesForArchitecture from '../../spectral/rules-architecture';
import { DiagnosticSeverity } from '@stoplight/types';
import * as winston from 'winston';
import { initLogger } from '../helper.js';
import { initLogger } from '../../logger.js';
import { ValidationOutput, ValidationOutcome } from './validation.output.js';
import { SpectralResult } from './spectral.result.js';
import createJUnitReport from './output-formats/junit-output.js';
Expand Down
2 changes: 1 addition & 1 deletion shared/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ export { runGenerate } from './commands/generate/generate.js';
export { ValidationOutput } from './commands/validate/validation.output.js';
export { CALM_META_SCHEMA_DIRECTORY } from './consts.js';
export { SchemaDirectory } from './schema-directory.js';
export { initLogger } from './commands/helper.js';
export { initLogger } from './logger.js';
export * from './types';
File renamed without changes.
2 changes: 1 addition & 1 deletion shared/src/schema-directory.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SchemaDirectory } from './schema-directory';
import { readFile } from 'node:fs/promises';

jest.mock('./commands/helper', () => {
jest.mock('./logger', () => {
return {
initLogger: () => {
return {
Expand Down
2 changes: 1 addition & 1 deletion shared/src/schema-directory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { join } from 'path';
import pointer from 'json-pointer';
import { mergeSchemas, updateStringValuesRecursively } from './util.js';
import { Logger } from 'winston';
import { initLogger } from './commands/helper.js';
import { initLogger } from './logger.js';

/**
* Stores a directory of schemas and resolves references against that directory.
Expand Down