에뮬레이터 도구 모음 UI에서 로그 쿼리

Firebase Local Emulator Suite는 에뮬레이터 로그 보기 지원을 포함하는 풍부한 사용자 인터페이스를 제공합니다. 이 페이지에 설명된 쿼리 구문을 사용하여 Emulator Suite UI에서 로그를 필터링할 수 있습니다.

이 언어 및 문법에 대한 다음 사항에 유의하세요.

  • 지원되는 작업:

    • 정확한 비교(key=value)
    • 퍼지 텍스트 검색(search=value 또는 키가 지정되지 않은 텍스트)
    • 공백 또는 줄바꿈으로 구분된 여러 key=value 표현식을 사용하는 논리적 AND 조합(예: search=github search=com). and 키워드는 지원되지 않습니다.
  • 명시적 키가 없는 쿼리는 공백을 포함하여 단일 search 용어로 처리됩니다.

  • 따옴표는 명시적 key=value 표현식의 값에서만 지원됩니다(예: search="github"). 값에 공백이나 줄바꿈이 포함된 경우를 제외하고는 선택사항입니다(예: search="hello world").

다음은 Emulator Suite UI에 로그 쿼리 언어를 사용하는 몇 가지 예시입니다.

// Find info logs only.
level=info

// Find logs for the `sayHelloWorld` function.
metadata.emulator.name=functions
metadata.function.name=sayHelloWorld

// Find any log mentioning `"hello world"`.
hello world  // turns into `search="hello world"` internally

// Return any Hosting `POST` requests.
metadata.emulator.name=hosting
search=POST

키워드

Emulator Suite UI 로그 쿼리 언어는 다음 키워드를 지원합니다.

level

로그 수준입니다.

warn, info, error 중 하나입니다.

퍼지 검색에서 일치시킬 텍스트입니다.

예를 들어 search=abc는 "abc" 텍스트가 있는 로그를 반환합니다.

search 키워드를 사용하여 여러 퍼지 검색을 결합하거나(예: search=github search=com) 퍼지 검색을 다른 키워드 검색과 결합합니다(예: metadata.emulator.name=hosting search=POST).

metadata

에뮬레이터 또는 함수 이름과 같은 로그 항목에 대한 메타데이터입니다.

metadata.emulator.name

로그를 생성한 에뮬레이터입니다.

firestore, functions, database, pubsub, hosting, storage 중 하나입니다.

metadata.function.name

앱 코드에 정의된 함수 이름입니다.

user

앱 코드에서 로깅된 모든 JSON 데이터는 user에서 쿼리할 수 있습니다.

예를 들면 다음과 같습니다.

console.log(JSON.stringify({hello: "world"}))

로그 출력은 user.hello="world"(또는 user.hello=world)로 쿼리할 수 있습니다.