Remark: Worked fine with console, same options not working with file logging.
Posts made by Michael-DE
-
RE: How to use format options for logging
-
RE: How to use format options for logging
I'm in a hurry, so quick:
"logger": { "console": { "transport": "console", "level": "debug", "timestamp": function() {return Date.now()}, formatter: function(options) {return options.timestamp() + ' ' +options.level.toUpperCase() + ' ' +(options.message ? options.message : '') +(options.meta && Object.keys(options.meta).length ? '\n\t'+ JSON.stringify(options.meta) : '' ); }} }
worked fine. Thx for the info about version 2 :)
-
RE: How to use format options for logging
thx for your answer.
I tried
"logger": { "console": { "transport": "console", "level": "debug", "format": winston.format.combine(winston.format.timestamp({format: 'YYYY-MM-DD HH:mm:ss'}),winston.format.json(),winston.format.printf(function(info){return info.timestamp.toString()+' > '+info.message}))} }
and also
const winston = require('winston') jsreport.logger.add(winston.transports.Console, { level: 'info' })
first example causes no changes and the second one did not work, as i know now, because of version 3 of winston i uses within my app. I will try the timestamp and formatter option of version 2 of winston later this day and will see, if get an other result.
-
How to use format options for logging
Hi all,
I want to use winston format printf, timestamp, etc. to give the report logging (nodejs: jsreport-core) the same look than the rest of my app. I tried a lot, but can not find a solution. I was not able to add the existing winston loggin of the app, nor use format options within the extensions options.Any help here?
-
RE: different header/footer examples not working within my node.js testing environment
Thanks a lot @jan_blaha Works like a charm and saved me a lot of time.
-
different header/footer examples not working within my node.js testing environment
Hi folks,
since days I am trying to get a working environment of different headers and/or footers test reports listed in playground. The main problem are empty or null header/footer values for handlebar entries. Also page counters (by 5 of $pdf.pages) will set to 1 of 3 on all pages instead of 1 of 3, 2 of 3, 3 of 3). I am also unable to find really useful examples.
I tried a full server installation with all modules and a smaller one with only some of them (assets, chrome-pdf, cli, core, docx, handlebars, pdf-util, scripts). Here some code, but I also tried pdfOperations and additional template entries. The header file is also an example of the playground and very simple ('''{{#each $pdf.pages}}<span>Seite: {{testPageDummy 'page Dummy'}}</span>{{#if 5}})... '''). Does anyone have an working example of node.js code with an header, chrome-pdf and handlebar?jsreport.render({ template: { content: fs.readFileSync('./templates/sample/template-main.html').toString('utf8'), engine: 'handlebars', recipe: 'chrome-pdf', chrome: { displayHeaderFooter: true, headerTemplate: fs.readFileSync('./templates/sample/template-header.html').toString('utf8'), footerTemplate: '', marginTop: '100px', marginBottom:'0px', }, helpers: fs.readFileSync('./templates/sample/template-helpers.js').toString('utf8'), scripts: [{ content: fs.readFileSync('./templates/sample/template-script.js').toString('utf8'), }], } })``` Thanks a lot for every small info and/or code example.