diff --git a/lib/src/client.ts b/lib/src/client.ts index b206400..4a981b8 100644 --- a/lib/src/client.ts +++ b/lib/src/client.ts @@ -27,11 +27,11 @@ import { DecodedIDTokenPayload, CustomGrantConfig, FetchResponse, - AsgardeoAuthException + AsgardeoAuthException, + Logger } from "@asgardeo/auth-node"; import { CookieConfig, DEFAULT_LOGIN_PATH, DEFAULT_LOGOUT_PATH } from "./constants"; import { ExpressClientConfig, UnauthenticatedCallback } from "./models"; -import { Logger } from "./utils/logger-util"; import express from "express"; import { v4 as uuidv4 } from "uuid"; import { asgardeoExpressAuth, protectRoute } from "./middleware"; diff --git a/lib/src/middleware/authentication.ts b/lib/src/middleware/authentication.ts index 843368f..4192136 100644 --- a/lib/src/middleware/authentication.ts +++ b/lib/src/middleware/authentication.ts @@ -16,12 +16,11 @@ * under the License. */ -import { AsgardeoAuthException, Store, TokenResponse } from "@asgardeo/auth-node"; +import { AsgardeoAuthException, Store, TokenResponse, Logger } from "@asgardeo/auth-node"; import express from "express"; import { AsgardeoExpressClient } from "../client"; import { DEFAULT_LOGIN_PATH, DEFAULT_LOGOUT_PATH } from "../constants"; import { ExpressClientConfig } from "../models"; -import { Logger } from "../utils/logger-util"; export const asgardeoExpressAuth = ( asgardeoExpressClient: AsgardeoExpressClient, diff --git a/lib/src/middleware/protect-route.ts b/lib/src/middleware/protect-route.ts index 50208fd..8d99ea2 100644 --- a/lib/src/middleware/protect-route.ts +++ b/lib/src/middleware/protect-route.ts @@ -19,7 +19,7 @@ import express from "express"; import { AsgardeoExpressClient } from "../client"; import { UnauthenticatedCallback } from "../models"; -import { Logger } from "../utils/logger-util"; +import { Logger } from "@asgardeo/auth-node"; export const protectRoute = ( asgardeoExpressClient: AsgardeoExpressClient, diff --git a/lib/src/utils/logger-util.ts b/lib/src/utils/logger-util.ts deleted file mode 100644 index 18a6d22..0000000 --- a/lib/src/utils/logger-util.ts +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright (c) 2022, WSO2 Inc. (http://www.wso2.com) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* eslint-disable no-console */ - -import { LOGGER_CONFIG } from "../constants"; -export class Logger { - - // eslint-disable-next-line @typescript-eslint/no-empty-function - private constructor() { } - - public static debug(message: string): void { - if (process.env.DEBUG) - console.log( - LOGGER_CONFIG.bgGreen, - LOGGER_CONFIG.fgBlack, - "DEBUG", - LOGGER_CONFIG.reset, - LOGGER_CONFIG.fgGreen, - message, - LOGGER_CONFIG.reset - ); - } - - public static warn(message: string): void { - if (process.env.DEBUG) - console.log( - LOGGER_CONFIG.bgYellow, - LOGGER_CONFIG.fgBlack, - "WARNING", - LOGGER_CONFIG.reset, - LOGGER_CONFIG.fgYellow, - message, - LOGGER_CONFIG.reset - ); - } - - public static error(message: string): void { - if (process.env.DEBUG) - console.log( - LOGGER_CONFIG.bgRed, - LOGGER_CONFIG.fgBlack, - "ERROR", - LOGGER_CONFIG.reset, - LOGGER_CONFIG.fgRed, - message, - LOGGER_CONFIG.reset - ); - } - -}