graphql-yoga
Version:
17 lines (16 loc) • 576 B
JavaScript
import { Logger } from '@graphql-hive/logger';
/**
* Creates a {@link Logger} out of the `logging` option of the server.
*
* Kept in sync with Hive Gateway's `createLoggerFromLogging` so that both products
* interpret the `logging` option in exactly the same way.
*/
export function createLoggerFromLogging(logging) {
if (logging == null || typeof logging === 'boolean') {
return new Logger({ level: logging === false ? false : 'info' });
}
if (typeof logging === 'string') {
return new Logger({ level: logging });
}
return logging;
}