Delete logger.js
Browse files
logger.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
| 1 |
-
import { isDevMode } from './config.js'
|
| 2 |
-
|
| 3 |
-
export function logInfo(message, data = null) {
|
| 4 |
-
console.log(`[INFO] ${message}`)
|
| 5 |
-
if (data && isDevMode()) {
|
| 6 |
-
console.log(JSON.stringify(data, null, 2))
|
| 7 |
-
}
|
| 8 |
-
}
|
| 9 |
-
|
| 10 |
-
export function logDebug(message, data = null) {
|
| 11 |
-
if (isDevMode()) {
|
| 12 |
-
console.log(`[DEBUG] ${message}`)
|
| 13 |
-
if (data) {
|
| 14 |
-
console.log(JSON.stringify(data, null, 2))
|
| 15 |
-
}
|
| 16 |
-
}
|
| 17 |
-
}
|
| 18 |
-
|
| 19 |
-
export function logError(message, error = null) {
|
| 20 |
-
console.error(`[ERROR] ${message}`)
|
| 21 |
-
if (error && isDevMode()) {
|
| 22 |
-
console.error(error)
|
| 23 |
-
}
|
| 24 |
-
}
|
| 25 |
-
|
| 26 |
-
export function logRequest(method, url, headers = null, body = null) {
|
| 27 |
-
if (isDevMode()) {
|
| 28 |
-
console.log(`[REQUEST] ${method} ${url}`)
|
| 29 |
-
if (headers) console.log('[HEADERS]', JSON.stringify(headers, null, 2))
|
| 30 |
-
if (body) console.log('[BODY]', JSON.stringify(body, null, 2))
|
| 31 |
-
}
|
| 32 |
-
}
|
| 33 |
-
|
| 34 |
-
export function logResponse(status, headers = null, body = null) {
|
| 35 |
-
if (isDevMode()) {
|
| 36 |
-
console.log(`[RESPONSE] ${status}`)
|
| 37 |
-
if (headers) console.log('[HEADERS]', JSON.stringify(headers, null, 2))
|
| 38 |
-
if (body) console.log('[BODY]', JSON.stringify(body, null, 2))
|
| 39 |
-
}
|
| 40 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|