aaronransley / nuxt-winston-log Goto Github PK
View Code? Open in Web Editor NEWNuxt module for logging SSR errors using winston
Nuxt module for logging SSR errors using winston
Our nuxt2 app is configured to use your plugin, which registers this render:errorMiddleware
hook.
However, even though we are intentionally forcing errors to happen in the application, nothing is logged.
What does that hook do, exactly? And which types of errors would be logged through it?
I tried to configure like this
winstonLog: {
transportOptions: {
format: combine(
timestamp(),
prettyPrint()
),
},
transports: [
new transports.File({
level: 'info',
filename: 'access.log',
}),
new transports.File({
level: 'error',
filename: 'error.log',
})
]
},
But it doesn't work. I want to scope error logs in error.log file and info logs in access.log file.
Do you have any middleware/servermiddleware example?
Getting "cannot set headers" and/or page not loading. So I guess im missing something :(
edit: I have it working and showing in grafana, just one issue with servermiddleware/middleware.
Hello,
I would like use $winstonLog
on asyncData
method.
But Property '$winstonLog' does not exist on type 'Context'
...
Do you have an idea for use it ?
async asyncData(ctx: Context) {
ctx.$winstonLog.info('Hello');
}
Thank you
If possible, please add some type declarations for Typescript support
Hello, can i log only error events? Give me example please.
hi,
I have nuxt-winston-log setup in my Nuxt 2 app to output to the console transport, as such:
winstonLog: {
useDefaultLogger: false,
loggerOptions: {
format: combine(timestamp(), errors({ stack: true }), json()),
transports: [new transports.Console()],
},
},
Works great in Nuxt 2, but for some reason, nothing happens in a Nuxt 3 app :|
Any idea why ?
Hello! When I use the logger with the console transport I don't want to write the filesystem in any way. This can be an issue for read only filesystems. This line
Line 21 in 4219b77
In our application, some of the HTTP calls done are server-side (asyncData / page level) but others client-side (mounted hook, created hook, fetch hook). How would the latter be logged with winston? Is it possible?
I have an issue with access logs.
In readme: "info level: Basic access logs for all endpoints in your Nuxt app"
But, if i set transport config:
new transports.File({
format: combine(
timestamp(),
prettyPrint()
),
level: 'info',
logPath: '/var/log/frontier/',
filename: '/var/log/frontier/access.log',
})
And after in some vue file, for eg index.vue get any simple throw:
mounted() {
throw "Warning test";
}
In my access.log file I have access logs and throw message in strange format:
'0': 'W',
'1': 'a',
'2': 'r',
'3': 'n',
'4': 'i',
'5': 'n',
'6': 'g',
'7': ' ',
'8': 't',
'9': 'e',
'10': 's',
'11': 't',
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.