本文整理汇总了TypeScript中@sample-stack/utils.logger.warn方法的典型用法代码示例。如果您正苦于以下问题:TypeScript logger.warn方法的具体用法?TypeScript logger.warn怎么用?TypeScript logger.warn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@sample-stack/utils.logger
的用法示例。
在下文中一共展示了logger.warn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: callback
origin: (origin, callback) => {
if (corsWhitelist.indexOf(origin) !== -1) {
callback(null, true);
} else {
// TODO: only throw when in debug mode
logger.error('url (%s) is not in the whitelist', origin);
// callback(new Error('Not allowed by CORS'))
logger.warn('allowing all origins temporarily, you need to disable it.');
callback(null, true);
}
},
示例2: require
import { invert, isArray } from 'lodash';
import { GRAPHIQL_ROUTE } from '../ENDPOINTS';
import { logger } from '@sample-stack/utils';
var reqlib: any = require('app-root-path');
let persistCache = true;
let queryMap;
try {
queryMap = reqlib.require('@sample-stack/graphql-gql/extracted_queries.json');
} catch (err) {
logger.warn('extracted_queries.json file is unavailable, disabling persist queries');
}
export const persistedQueryMiddleware = (req, res, next) => {
if (queryMap) {
const invertedMap = invert(queryMap);
if (isArray(req.body)) {
req.body = req.body.map(body => {
const id = body['id'];
return {
query: invertedMap[id],
...body,
};
});
next();
} else {
if (!__DEV__ || (req.get('Referer') || '').indexOf(GRAPHIQL_ROUTE) < 0) {
res.status(500).send('Unknown GraphQL query has been received, rejecting...');