mirror of
https://github.com/overleaf/overleaf.git
synced 2025-12-05 01:10:29 +00:00
add latexmk `-time` option to clsi and record performance logs GitOrigin-RevId: 467473859359913da73f83e10b63b45603ea175c
41 lines
1.1 KiB
JavaScript
41 lines
1.1 KiB
JavaScript
const Path = require('node:path')
|
|
|
|
const CLSI_REQUEST_SERIALIZED_PROPERTIES = [
|
|
'compiler',
|
|
'compileFromClsiCache',
|
|
'populateClsiCache',
|
|
'enablePdfCaching',
|
|
'pdfCachingMinChunkSize',
|
|
'timeout',
|
|
'imageName',
|
|
'draft',
|
|
'stopOnFirstError',
|
|
'check',
|
|
'flags',
|
|
'compileGroup',
|
|
'syncType',
|
|
]
|
|
|
|
module.exports = {
|
|
/**
|
|
* Serializer for a CLSI request object.
|
|
* Only includes properties useful for logging.
|
|
* Excludes large, sensitive, or irrelevant properties (e.g., 'syncState', 'resources').
|
|
* To add more properties, update the allowed properties above.
|
|
*
|
|
* @param {object} clsiRequest - The original CLSI request object.
|
|
* @returns {object} A summarized version of the request object for logging.
|
|
*/
|
|
clsiRequest(clsiRequest) {
|
|
const summary = {}
|
|
for (const key of CLSI_REQUEST_SERIALIZED_PROPERTIES) {
|
|
if (key === 'imageName' && clsiRequest.imageName) {
|
|
summary.imageName = Path.basename(clsiRequest.imageName)
|
|
} else if (clsiRequest[key] !== undefined) {
|
|
summary[key] = clsiRequest[key]
|
|
}
|
|
}
|
|
return summary
|
|
},
|
|
}
|