Skip to content

Commit

Permalink
Add cspell to logger calls (#1631)
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztofzuraw authored Oct 18, 2024
1 parent ada478b commit 59cf745
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 29 deletions.
8 changes: 7 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
{
"name": "comments",
"pattern": ["comment-single-line", "comment-multi-line"]
},
{
"name": "logger",
"pattern": "/logger\\.(?:warn|error|info|debug)\\(.*\\)/g"
}
],
"languageSettings": [
Expand All @@ -20,7 +24,7 @@
},
{
"languageId": ["javascriptreact", "typescriptreact", "typescript", "javascript"],
"includeRegExpList": ["comments"]
"includeRegExpList": ["comments", "logger"]
}
],
"words": [
Expand All @@ -41,6 +45,8 @@
"taxjar",
"unobfuscated",
"upstash",
"upserted",
"upserting",
"urql"
],
"language": "en-US",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { TRPCError } from "@trpc/server";
import { z } from "zod";

import { AppConfigMetadataManager } from "@/modules/configuration/app-config-metadata-manager";
import { createSettingsManager } from "@/modules/configuration/metadata-manager";
import { ChannelProviderConnectionConfig } from "@/modules/configuration/schemas/channel-provider-connection.schema";
import { protectedClientProcedure } from "@/modules/trpc/protected-client-procedure";
import { router } from "@/modules/trpc/trpc-server";
import { z } from "zod";

import { FetchChannelsDocument } from "../../../generated/graphql";
import { TRPCError } from "@trpc/server";
import { createLogger } from "../../logger";

const procedure = protectedClientProcedure.use(({ ctx, next }) => {
Expand Down Expand Up @@ -82,7 +84,7 @@ export const channelProviderConnectionRouter = router({
} catch (e) {
switch ((e as { cause: string }).cause) {
case "PROVIDER_DOESNT_EXIST":
logger.warn("Provider doesnt exist");
logger.warn("Provider doesn't exist");
throw new TRPCError({
code: "BAD_REQUEST",
cause: "PROVIDER_DOESNT_EXIST",
Expand Down
2 changes: 1 addition & 1 deletion apps/klaviyo/src/lib/klaviyo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const Klaviyo = (token: string): EmailServiceProvider => ({
}),
);

logger.info("Seding Klaviyo request", { url: "https://a.klaviyo.com/api/track" });
logger.info("Sending Klaviyo request", { url: "https://a.klaviyo.com/api/track" });

const response = await fetch("https://a.klaviyo.com/api/track", {
method: "POST",
Expand Down
4 changes: 2 additions & 2 deletions apps/klaviyo/src/pages/api/configuration.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { createProtectedHandler, NextProtectedApiHandler } from "@saleor/app-sdk/handlers/next";
import { EncryptedMetadataManager } from "@saleor/app-sdk/settings-manager";
import { wrapWithLoggerContext } from "@saleor/apps-logger/node";

import { withOtel } from "@saleor/apps-otel";
import { ObservabilityAttributes } from "@saleor/apps-otel/src/lib/observability-attributes";
import { createGraphQLClient } from "@saleor/apps-shared";

import { saleorApp } from "../../../saleor-app";
import { createSettingsManager } from "../../lib/metadata";
import { createLogger } from "../../logger";
Expand Down Expand Up @@ -65,7 +65,7 @@ const handler: NextProtectedApiHandler = async (request, res, ctx) => {

switch (request.method!) {
case "GET":
logger.info("Returing app configuration");
logger.info("Returning app configuration");

return res.json({
success: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { router } from "../trpc/trpc-server";
import { protectedClientProcedure } from "../trpc/protected-client-procedure";

import { AppConfigSchema, imageSizeInputSchema, titleTemplateInputSchema } from "./app-config";
import { TRPCError } from "@trpc/server";
import { z } from "zod";
import { createS3ClientFromConfiguration } from "../file-storage/s3/create-s3-client-from-configuration";

import { createLogger } from "../../logger";
import { checkBucketAccess } from "../file-storage/s3/check-bucket-access";
import { TRPCError } from "@trpc/server";
import { AttributeFetcher } from "./attribute-fetcher";
import { createS3ClientFromConfiguration } from "../file-storage/s3/create-s3-client-from-configuration";
import { renderHandlebarsTemplate } from "../handlebarsTemplates/render-handlebars-template";
import { protectedClientProcedure } from "../trpc/protected-client-procedure";
import { router } from "../trpc/trpc-server";
import { AppConfigSchema, imageSizeInputSchema, titleTemplateInputSchema } from "./app-config";
import { AttributeFetcher } from "./attribute-fetcher";
import { prepareExampleVariantData } from "./prepare-example-variant-data";
import { createLogger } from "../../logger";

export const appConfigurationRouter = router({
/**
Expand Down Expand Up @@ -152,7 +152,7 @@ export const appConfigurationRouter = router({
});
});

logger.debug("Returning attributes", { first: result[0], totaLength: result.length });
logger.debug("Returning attributes", { first: result[0], totalLength: result.length });

return result;
}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { router } from "../trpc/trpc-server";
import { protectedClientProcedure } from "../trpc/protected-client-procedure";
import { SetCategoryMappingInputSchema } from "./category-mapping-input-schema";
import { UpdateCategoryMappingDocument } from "../../../generated/graphql";
import { TRPCError } from "@trpc/server";
import { CategoriesFetcher } from "./categories-fetcher";

import { UpdateCategoryMappingDocument } from "../../../generated/graphql";
import { createLogger } from "../../logger";
import { protectedClientProcedure } from "../trpc/protected-client-procedure";
import { router } from "../trpc/trpc-server";
import { CategoriesFetcher } from "./categories-fetcher";
import { SetCategoryMappingInputSchema } from "./category-mapping-input-schema";

export const categoryMappingRouter = router({
/**
Expand All @@ -23,7 +24,7 @@ export const categoryMappingRouter = router({
});
});

logger.debug("Returning categories", { first: result[0], totaLength: result.length });
logger.debug("Returning categories", { first: result[0], totalLength: result.length });

return result;
}),
Expand Down
15 changes: 8 additions & 7 deletions apps/search/src/pages/api/setup-indices.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { createProtectedHandler, NextProtectedApiHandler } from "@saleor/app-sdk/handlers/next";
import { saleorApp } from "../../../saleor-app";
import { createSettingsManager } from "../../lib/metadata";
import { createLogger } from "../../lib/logger";
import { SettingsManager } from "@saleor/app-sdk/settings-manager";
import { wrapWithLoggerContext } from "@saleor/apps-logger/node";
import { withOtel } from "@saleor/apps-otel";
import { Client } from "urql";

import { ChannelsDocument } from "../../../generated/graphql";
import { saleorApp } from "../../../saleor-app";
import { AlgoliaSearchProvider } from "../../lib/algolia/algoliaSearchProvider";
import { AppConfigMetadataManager } from "../../modules/configuration/app-config-metadata-manager";
import { withOtel } from "@saleor/apps-otel";
import { createInstrumentedGraphqlClient } from "../../lib/create-instrumented-graphql-client";
import { createLogger } from "../../lib/logger";
import { loggerContext } from "../../lib/logger-context";
import { wrapWithLoggerContext } from "@saleor/apps-logger/node";
import { createSettingsManager } from "../../lib/metadata";
import { AppConfigMetadataManager } from "../../modules/configuration/app-config-metadata-manager";

const logger = createLogger("setupIndicesHandler");

Expand Down Expand Up @@ -69,7 +70,7 @@ export const setupIndicesHandlerFactory =

return res.status(200).end();
} catch (e) {
logger.error("Failed to update Algolia indicies", { error: e });
logger.error("Failed to update Algolia indices", { error: e });

return res.status(500).end();
}
Expand Down

0 comments on commit 59cf745

Please sign in to comment.