@imqa/custom-log
v0.0.2
Published
[![NPM Published Version][npm-version-img]][npm-url] [![NPM Last Update][npm-last-update-img]][npm-url] [![NPM Unpacked Size][npm-unpacked-size-img]][npm-url] [![NPM Downloads][npm-downloads-img]][npm-url] [![NPM Type Definitions][npm-types-img]][npm-url]
Readme
@imqa/custom-log
개요
@imqa/custom-log은 IMQA 모니터링 시스템에서 브라우저 console 로그를 캡처하고 보고합니다. OpenTelemetry 형식으로 로그를 기록하며, recordLog 함수를 통해 로그 메시지와 속성을 스팬 및 로그로 남깁니다. 개발자가 프로덕션 환경에서 애플리케이션의 동작을 모니터링하고 디버깅할 수 있도록 합니다.
주요 함수: recordLog
import { recordLog } from '@imqa/custom-log';
recordLog('로그 메시지', { customKey: 'customValue' });함수 설명
recordLog(message, attributes?, hint?)
message: string 또는 객체. 로그로 남길 메시지.attributes: 로그에 추가할 커스텀 속성(선택).hint: 트레이서, 로거, 화면 이름 옵션 등(선택).
기록되는 주요 속성
| 속성 | 타입 | 설명 |
|-----------|------|-------------|
| component | string | 로그 컴포넌트 이름 (log) |
| span.type | string | 스팬 타입 (log) |
| level | string | 로그 레벨 (info) |
| message | string | 로그 메시지 내용 |
| session.id | string | 사용자 세션 식별자 |
| screen.name | string | 화면/페이지 이름 |
| screen.type | string | 화면/페이지 타입 (page) |
| 기타 커스텀 속성 | string | attributes로 전달된 값 |
옵션(hint)
tracer: OpenTelemetry Tracer 객체(기본값 사용 가능)logger: OpenTelemetry Logger 객체(선택)screenNameOption: 화면 이름 옵션(선택)
예시
recordLog({ event: 'login', user: 'test' }, { env: 'prod' }, {
tracer: customTracer,
logger: customLogger,
screenNameOption: { screenNameType: 'routeOnly', urlWithSearchParams: true }
});라이센스
Copyright (c) 2024-2025 ONYCOM CO., LTD. All rights reserved.
