@re-ai/free-api
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -23,2 +23,3 @@ "use strict"; | ||
const url = `${this.host || ""}${params.url}`; | ||
Logger_1.Logger.debug("free api url:", url); | ||
const response = await fetch(url, { | ||
@@ -33,3 +34,3 @@ method: params.method, | ||
const contentType = response.headers.get('content-type') || ""; | ||
Logger_1.Logger.debug("Base contentType", contentType); | ||
// Logger.debug("Base contentType", contentType) | ||
if (contentType.includes("application/json")) { | ||
@@ -36,0 +37,0 @@ return await response.json(); |
@@ -12,3 +12,3 @@ "use strict"; | ||
})(LogLevel || (exports.LogLevel = LogLevel = {})); | ||
const LOGGER_PREFIX = process.env.LOGGER_PREFIX || "[ReAI]"; | ||
const LOGGER_PREFIX = process.env.LOGGER_PREFIX || "[ReAI-Free-Api]"; | ||
class Logger { | ||
@@ -19,3 +19,3 @@ static logLevel = LogLevel.INFO; // 默认日志级别 | ||
if (!this.initialized) { | ||
const logLevelEnv = process.env.LOGGER_LEVEL || "INFO"; | ||
const logLevelEnv = process.env.LOGGER_LEVEL || process.env.LOGGER_LEVEL_FREE_API || "INFO"; | ||
if (logLevelEnv) { | ||
@@ -22,0 +22,0 @@ this.logLevel = LogLevel[logLevelEnv] || LogLevel.INFO; |
{ | ||
"name": "@re-ai/free-api", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -33,2 +33,3 @@ import { url } from "inspector"; | ||
const url = `${this.host || ""}${params.url}` | ||
Logger.debug("free api url:", url) | ||
const response = await fetch(url, { | ||
@@ -45,3 +46,3 @@ method: params.method, | ||
const contentType = response.headers.get('content-type') || "" | ||
Logger.debug("Base contentType", contentType) | ||
// Logger.debug("Base contentType", contentType) | ||
if (contentType.includes("application/json")) { | ||
@@ -48,0 +49,0 @@ return await response.json() |
@@ -9,3 +9,3 @@ export enum LogLevel { | ||
const LOGGER_PREFIX = process.env.LOGGER_PREFIX || "[ReAI]"; | ||
const LOGGER_PREFIX = process.env.LOGGER_PREFIX || "[ReAI-Free-Api]"; | ||
@@ -18,3 +18,3 @@ export class Logger { | ||
if (!this.initialized) { | ||
const logLevelEnv = process.env.LOGGER_LEVEL || "INFO"; | ||
const logLevelEnv = process.env.LOGGER_LEVEL || process.env.LOGGER_LEVEL_FREE_API || "INFO"; | ||
if (logLevelEnv) { | ||
@@ -21,0 +21,0 @@ this.logLevel = LogLevel[logLevelEnv as keyof typeof LogLevel] || LogLevel.INFO; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23008
605