-
Notifications
You must be signed in to change notification settings - Fork 5
Logging Configuration
Nishant Aanjaney Jalan edited this page Mar 24, 2024
·
6 revisions
Minimally, there are 3 steps to create your first logger.
- Create a
Logestic
instance. - Define the parameters you wish to
use
. -
Format
the string given the parameters. Also see "More on formatting".
Putting the 3 steps together, you get:
import { Logestic } from 'logestic';
const logger = new Logestic() // Step 1
.use(['method', 'path']) // Step 2
.format({ // Step 3
onSuccess({ method, path }) {
return `${method} ${path} was called and handled without server error.`;
},
onFailure({ request, error, code }) {
return `Oops, ${error} was thrown with code: ${code}`;
}
})