For AI agents: the complete documentation index is available at https://canary.gukhanmun.org/ko-KR/llms.txt, the full documentation bundle is available at https://canary.gukhanmun.org/ko-KR/llms-full.txt, and this page is available as Markdown at https://canary.gukhanmun.org/ko-KR/guide/javascript/logging.md.
  • 한국어 (한글)
  • 로깅

    두 JavaScript 바인딩 @gukhanmun/napi와 @gukhanmun/wasm은 LogTape를 씁니다. 기본적으로는 사용 중단 경고(deprecation warning)를 포함해 로그를 출력하지 않습니다. 어떤 로그를 어디로 보낼지는 응용 프로그램에서 정합니다.

    응용 프로그램에서 LogTape 설정하기

    @logtape/logtape를 응용 프로그램의 의존성으로 추가합니다. npm을 쓴다면 다음과 같이 설치합니다:

    npm install @logtape/logtape

    응용 프로그램의 진입점에서 변환기를 쓰기 전에 configure()를 호출합니다. 이미 LogTape를 설정하고 있다면 configure()를 다시 호출하지 말고, 그 설정에 Gukhanmun의 로그 분류를 추가합니다.

    import { configure, getConsoleSink } from "@logtape/logtape";
    
    await configure({
      sinks: { console: getConsoleSink() },
      loggers: [
        { category: ["gukhanmun"], lowestLevel: "warning", sinks: ["console"] },
      ],
    });

    이 설정은 Gukhanmun의 경고 이상 등급의 로그를 콘솔에 출력합니다. 다른 출력선이나 필터를 설정하려면 LogTape 설정 문서를 보십시오.

    로그 분류

    LogTape의 로그 분류에는 계층이 있습니다. ["gukhanmun"]을 설정하면 Gukhanmun의 모든 하위 분류에 적용됩니다. 특정 분류만 설정할 수도 있습니다:

    • ["gukhanmun", "format"]: convert()나 stream()에 더는 사용을 권하지 않는 형식 인수를 넘겼을 때 남는 경고입니다. 두 바인딩 모두 현재는 이 분류에만 로그를 남깁니다.

    사용 중단 경고

    사용 중단 권고(deprecation)는 아직 쓸 수 있지만 더는 사용을 권하지 않는다는 뜻입니다. 이전 형식 문자열과 Markdown 객체는 Gukhanmun 1.0에서 제거합니다. 이 값을 convert()나 stream()에 넘기면 ["gukhanmun", "format"] 분류에 warning 등급의 로그가 남습니다. 경고마다 바꿔 쓸 미디어 타입을 알려 줍니다. 여러 분류에서 사용 중단 경고만 골라 보려면 로그의 kind: "deprecation" 속성을 쓰십시오.