Skip to content

Commit

Permalink
Merge pull request #46 from 0xPolygon/logger-fix
Browse files Browse the repository at this point in the history
fix proof-gen logging
  • Loading branch information
rahuldamodar94 authored Sep 1, 2024
2 parents c3c3361 + 27aff3e commit 6677fce
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
14 changes: 6 additions & 8 deletions src/config/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const logFormat = format.combine(
format: 'YY-MM-DD HH:mm:ss'
}),
format.printf(
info => `${info.timestamp} - ${info.level} : ${info.message}`
(info) => `${info.timestamp} - ${info.level} : ${info.message}`
)
)

Expand All @@ -35,24 +35,22 @@ const logger = createLogger({
logFormat
),
defaultMeta: { service: 'user-service' },
transports: [
new Sentry(options)
]
transports: [new Sentry(options)]
})

//
// If we're not in production then log to the `console` with the format:
// `${info.level}: ${info.message} JSON.stringify({ ...rest }) `
//
if (process.env.NODE_ENV !== 'production') {
logger.add(new transports.Console({
logger.add(
new transports.Console({
format: format.combine(
format.json(),
format.metadata(),
format.errors({ stack: true }),
logFormat
)
}))
}
})
)

export default logger
7 changes: 1 addition & 6 deletions src/controllers/zkEVMController.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@ export default {
const networkID = req.query.net_id
const depositCount = req.query.deposit_cnt
const network = req.params.network
const responseObj = await bridge(
networkID,
depositCount,
network
)
console.log(responseObj)
const responseObj = await bridge(networkID, depositCount, network)
handleResponse({ res, data: responseObj })
} catch (error) {
if (error instanceof InfoError) {
Expand Down
4 changes: 2 additions & 2 deletions src/services/v1ProofGenerationServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ export async function generateExitPayload(
tokenIndex
)
} catch (error) {
logger.error(error)
logger.info(error)
if (
error.message ===
'Index is grater than the number of tokens in this transaction'
Expand Down Expand Up @@ -341,7 +341,7 @@ export async function generateAllExitPayloads(

break
} catch (error) {
logger.error(error)
logger.info(error)
if (
error.type === errorTypes.TxNotCheckpointed ||
error.type === errorTypes.IncorrectTx ||
Expand Down

0 comments on commit 6677fce

Please sign in to comment.