feat: enhance donation creation logging and adjust amount limits

- Add detailed secure logging throughout the donation creation API route for production debugging, including request receipt, validation results, amount calculations, PIX creation success, and error handling
- Update custom donation amount schema to allow minimum 0.01 and maximum 100,000 for broader donation flexibility
- Modify secure logger to always output data in production for improved monitoring and troubleshooting
This commit is contained in:
Evandro Fonseca Junior committed 2025-10-26 23:24:46 -03:00
1 parent d05fbe967e
commit e30d9493ff
4 files changed
+58 -12

No files matched your search

+6 -4
View File
@@ -155,9 +155,10 @@ function maskSensitiveData(obj: any, options: MaskOptions = {}): any {
export const secureLogger = {
/**
* Log info com mascaramento automático
* SEMPRE exibe em produção para debug
*/
info(message: string, data?: any) {
if (isProduction && data) {
if (data) {
const masked = maskSensitiveData(data, {
maskEmail: true,
maskDocument: true,
@@ -165,15 +166,16 @@ export const secureLogger = {
});
console.log(`ℹ️ ${message}`, JSON.stringify(masked, null, 2));
} else {
console.log(`ℹ️ ${message}`, data ? JSON.stringify(data, null, 2) : "");
console.log(`ℹ️ ${message}`, "");
}
},
/**
* Log debug com mascaramento automático
* SEMPRE exibe em produção para debug
*/
debug(message: string, data?: any) {
if (isProduction && data) {
if (data) {
const masked = maskSensitiveData(data, {
maskEmail: true,
maskDocument: true,
@@ -181,7 +183,7 @@ export const secureLogger = {
});
console.debug(`🔍 ${message}`, JSON.stringify(masked, null, 2));
} else {
console.debug(`🔍 ${message}`, data ? JSON.stringify(data, null, 2) : "");
console.debug(`🔍 ${message}`, "");
}
},