How to use the error function from pino

Find comprehensive JavaScript pino.error code examples handpicked from public code repositorys.

31
32
33
34
35
36
37
38
39
  })
}

app.listen(3000, (err) => {
  if (err) {
    logger.error('The app could not start')
  }
  logger.info('The app is listening on 3000')
})
fork icon23
star icon296
watch icon8

+ 2 other calls in file

45
46
47
48
49
50
51
52
53
54
        subscribe('queue1', handlersForQueue1),
        subscribe('queue2', handlersForQueue2)
    ]);
}
catch (err) {
    logger.error('railed to subscribe', err);
}
```

With the above handlers registered, let's publish some events to the bus.
fork icon8
star icon46
watch icon7

+ 7 other calls in file

241
242
243
244
245
246
247
248
249
250
        fn: systemHealth.bind(null, redisClient, ping, getCount)
      });
      return;
    })
    .catch((err) => {
      logger.error({err}, 'Error creating health check server');
    });
}
if ('test' !== process.env.NODE_ENV) {
  /* update call stats periodically */
fork icon12
star icon2
watch icon0

+ 3 other calls in file

41
42
43
44
45
46
47
48
49
50
        name,
        filename
      ));
      fs.watch(pluginFolder + "/" + name, global.reload);
    } catch (e) {
      logger.error(e);
      delete global.plugins[filename];
    }
  }
});
fork icon0
star icon0
watch icon0

+ 3 other calls in file

111
112
113
114
115
116
117
118
119
120
      });
    }

    values[metricName] = value;
  } catch (error) {
    logger.error(error);
  }
}

for (const k of Object.keys(values)) {
fork icon0
star icon0
watch icon0

11
12
13
14
15
16
17
18
19
        logger.info('STATE: Connecting to MongoDB')
        await mongoClient.connect()
        logger.info('STATE: Successfully connected to MongoDB')
        return mongoClient
    } catch (error) {
        logger.error('STATE: Connection to MongoDB failed!', error)
        process.exit()
    }
}
fork icon0
star icon0
watch icon0