diff --git a/src/logger.js b/src/logger.js index ed4e1d1..775eaeb 100644 --- a/src/logger.js +++ b/src/logger.js @@ -1,4 +1,5 @@ import { pino } from "pino"; +import pretty from "pino-pretty"; import path from "path"; let fileLogger; @@ -11,22 +12,25 @@ let logFileDestination; * @param logLevel the file log level */ function loggerInit(directory, quiet = false, logLevel = 'info') { - logFileDestination = path.join(directory, 'log_' + (new Date()).toISOString() + '.txt'); - fileLogger = pino(pino.transport({ - targets: [ - { - target: 'pino-pretty', - options: { - destination: logFileDestination, - mkdir: true, - colorize: false, - translateTime: 'yyyy-mm-dd HH:MM:ss', - ignore: 'pid,hostname' - }, - } - ] - })); - fileLogger.level = logLevel; + // replaces characters that windows does not allow in filenames + logFileDestination = path.join(directory, 'log_' + new Date().toISOString().replaceAll(/[.:]/g, '-') + '.txt'); + const streams = [ + { + level: logLevel, + stream: pretty({ + destination: logFileDestination, + mkdir: true, + colorize: false, + translateTime: 'yyyy-mm-dd HH:MM:ss', + ignore: 'pid,hostname' + }) + }, + ] + + // using pino.multistream seems to resolve some issues with file logging in windows environments that occurred when pino.transport was used instead + fileLogger = pino({ + level: logLevel + }, pino.multistream(streams)); if (quiet) { console.log = function(){}; console.info = function(){}; diff --git a/src/pipelineResources.js b/src/pipelineResources.js index ebaa8df..1c70b0c 100644 --- a/src/pipelineResources.js +++ b/src/pipelineResources.js @@ -169,7 +169,8 @@ async function checkPipeline() { startSpinner('Checking for API...'); const notFound = 'API not found'; try { - const command = new ListGraphqlApisCommand({apiType: "GRAPHQL"}); + // set maxResults to max allowed value as workaround until https://github.com/aws/amazon-neptune-for-graphql/issues/39 is addressed + const command = new ListGraphqlApisCommand({apiType: "GRAPHQL", maxResults: 25}); const response = await appSyncClient.send(command); response.graphqlApis.forEach(element => { if (element.name == NAME + 'API') {