How to use the mwp-logger-plugin.logger.info function in mwp-logger-plugin

To help you get started, we’ve selected a few mwp-logger-plugin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github meetup / meetup-web-platform / packages / mwp-api-proxy-plugin / src / util / receive.js View on Github external
} catch (err) {
			// probably not JSON, could be an HTML response
			const titleContent = /<title>(.+?)&lt;\/title&gt;/.exec(body);
			errorMessage = titleContent ? titleContent[1] : 'REST API error';
		}
		logError({
			...logBase,
			body: body.length &gt; 512 ? `${body.substr(0, 512)}...` : body,
			err: new Error(errorMessage),
			context: response, // this will provide limited info - check apiRequest for more detail
		});
		return;
	}
	// not an error response - log in dev, not prod
	if (process.env.NODE_ENV !== 'production') {
		logger.info({
			...logBase,
			httpRequest: response,
		});
	}
};
</title>
github meetup / meetup-web-platform / packages / mwp-api-proxy-plugin / src / util / receive.js View on Github external
errorMessage = JSON.stringify(info.errors[0]) || body;
		} catch (err) {
			// probably not JSON, could be an HTML response
			const titleContent = /<title>(.+?)&lt;\/title&gt;/.exec(body);
			errorMessage = titleContent ? titleContent[1] : 'REST API error';
		}
		logError({
			...logBase,
			body: body.length &gt; 512 ? `${body.substr(0, 512)}...` : body,
			err: new Error(errorMessage),
			context: response, // this will provide limited info - check apiRequest for more detail
		});
		return;
	}
	// not an error response
	logger.info({
		...logBase,
		httpRequest: response,
	});
};
</title>
github meetup / meetup-web-platform / packages / mwp-test-utils / src / MockContainer.jsx View on Github external
function mapStateToProps(state) {
	logger.info(state);
	return {
		data: (state.api.foo || {}).value,
	};
}

mwp-logger-plugin

Hapi logging plugin for MWP apps

MIT
Latest version published 1 year ago

Package Health Score

39 / 100
Full package analysis

Similar packages