Adding new logging function

This commit is contained in:
2024-03-22 19:01:18 -05:00
parent 6dddc5799f
commit cac674e27a
6 changed files with 69 additions and 6 deletions

View File

@@ -1,6 +1,8 @@
import fetch from "node-fetch";
import { LoggingLevel, smartLogging } from "./helper.js";
const fetchEbayUserToken = async (authorizationCode) => {
smartLogging(LoggingLevel.AppTrace, `fetchEbayUserToken`);
const clientId = process.env.EBAY_CLIENT_ID;
const clientSecret = process.env.EBAY_CLIENT_SECRET;
const redirectUri = process.env.EBAY_REDIRECT_URI; // Make sure this matches the URI registered with eBay
@@ -33,7 +35,7 @@ const fetchEbayUserToken = async (authorizationCode) => {
const data = await response.json();
return data.access_token; // This is the User access token
} catch (error) {
console.error("Error fetching eBay user token:", error);
smartLogging(LoggingLevel.Error,`Error fetching eBay user token: ${JSON.stringify(error)}`);
throw error;
}
};