Skip to content

Commit

Permalink
Temp staging logging via generic logger
Browse files Browse the repository at this point in the history
  • Loading branch information
HughParry committed Jan 16, 2025
1 parent 3e5722b commit e26a5ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packages/provider/src/api/blacklistRequestInspector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,21 @@ class BlacklistRequestInspector {

try {
const userIpAddress = getIPAddress(rawIp);
console.log("TEMP IP LOG \n\n", userIpAddress, "\n\n");

const { userId, clientId } = this.extractIdsFromRequest(
requestHeaders,
requestBody,
);
console.log("TEMP USER ID LOG \n\n", userId, "\n\n");

return await this.blacklistInspector.isUserBlacklisted(
clientId,
userIpAddress,
userId,
);
} catch (err) {
console.error("\n\n---\n\nTEMP ERROR RESOLUTION\n\n---\n\n", err, "\n\nJSON STRINGIFIED\n---\n\n", JSON.stringify(err));
this.logger.error("Block Middleware Error:", err);

return true;
Expand Down
5 changes: 3 additions & 2 deletions packages/provider/src/api/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
// 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.
import { getLoggerDefault } from "@prosopo/common";
import { getLogger, getLoggerDefault } from "@prosopo/common";
import type { ProviderEnvironment } from "@prosopo/types-env";
import { createBlacklistInspector } from "@prosopo/user-access-policy";
import { BlacklistRequestInspector } from "./blacklistRequestInspector.js";

export const blockMiddleware = (providerEnvironment: ProviderEnvironment) => {
const logger = getLoggerDefault();
const logLevel = providerEnvironment.config.logLevel;
const logger = getLogger(logLevel, "blockMiddleware");

const userAccessRulesStorage = providerEnvironment
.getDb()
Expand Down

0 comments on commit e26a5ac

Please sign in to comment.