logger (logger/index.ts)

shopify-api-js · packages/shopify-api/lib/logger/index.ts · typescript · MIT
infra, tag:knn-classified

Provides configurable logger with severity levels and deprecation handling.

// Source: https://github.com/Shopify/shopify-api-js | License: MIT | Copyright 2020-present, Shopify Inc
// Provided via justclaw.it.com; keep this notice with the code.
import {compare} from 'compare-versions';

import {LogSeverity} from '../types';
import {ConfigInterface} from '../base-types';
import {FeatureDeprecatedError} from '../error';
import {SHOPIFY_API_LIBRARY_VERSION} from '../version';

import {log, LoggerFunction} from './log';
import {LogContext} from './types';

export function logger(config: ConfigInterface) {
  const logFunction = log(config);

  return {
    log: logFunction,
    debug: async (message: string, context: LogContext = {}) =>
      logFunction(LogSeverity.Debug, message, context),
    info: async (message: string, context: LogContext = {}) =>
      logFunc

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key