본문으로 건너뛰기
cccskills
무료GitHub에 공개

datagrok-logging

Guide for logging errors, warnings, and info messages in Datagrok packages

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md4.1 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Datagrok Logging & Notification API

Help the user choose and implement the correct logging/notification approach in Datagrok packages.

Usage

/datagrok-logging

User-Facing Notifications (Balloons)

Toast notifications shown to the user. Primary methods for communicating from package code.

import * as grok from 'datagrok-api/grok';

// Green balloon — success or informational
grok.shell.info('Operation completed');

// Red balloon — error
grok.shell.error('Something went wrong');

// Yellow balloon — warning
grok.shell.warning('Check your settings');

All three accept string | HTMLElement and an optional BalloonOptions:

interface BalloonOptions {
  oneTimeKey?: string;   // Show only once per key (prevents repeated identical messages)
  copyText?: string;     // Text copied to clipboard on click
  autoHide?: boolean;    // Auto-hide after timeout (default: true)
  timeout?: number;      // Timeout in seconds (default: 5)
}

grok.shell.error('Failed to connect', { timeout: 10 });
grok.shell.info('Copied!', { oneTimeKey: 'copy-hint', autoHide: true });

Server-Side Logging (DG.Logger)

For audit trails, usage tracking, and debug logging recorded on the Datagrok server. These do NOT show UI notifications.

import * as DG from 'datagrok-api/dg';

// Create a logger (optionally with default params attached to every entry)
const logger = DG.Logger.create({ params: { source: 'MyPackage' } });

// Log levels
logger.debug('Detailed diagnostic info', { step: 'init' });
logger.info('Normal operation', { action: 'loaded' });
logger.warning('Potential issue', { config: 'missing' });
logger.error('Something failed', { context: 'upload' }, stackTrace);
logger.audit('User did something', { item: 'report' });
logger.usage('Feature used', { feature: 'export' });

PackageLogger

Automatically tags log entries with the package name:

const logger = new DG.PackageLogger(_package);
logger.error('Connection failed');  // tagged with package name

LOG_LEVEL enum

DG.LOG_LEVEL.DEBUG   // 'debug'
DG.LOG_LEVEL.INFO    // 'info'
DG.LOG_LEVEL.WARNING // 'warning'
DG.LOG_LEVEL.ERROR   // 'error'
DG.LOG_LEVEL.AUDIT   // 'audit'
DG.LOG_LEVEL.USAGE   // 'usage'

Progress Indicator with Logging

For long-running operations with status updates shown in the task bar:

const pi = DG.TaskBarProgressIndicator.create('Processing...', { cancelable: true });
pi.update(50, 'Half done');
pi.log('Step 1 finished');   // Append to progress log
pi.close();

Log Event Stream

Subscribe to all log events in real time:

grok.events.onLog.subscribe((msg) => {
  console.log(`[${msg.level}] ${msg.message}`, msg.params);
});

When to Use What

ScenarioMethod
Tell the user something succeededgrok.shell.info()
Show a user-facing errorgrok.shell.error()
Show a user-facing warninggrok.shell.warning()
Log for debugging (server-side)logger.debug() / logger.info()
Record errors for diagnosticslogger.error(message, params, stackTrace)
Track feature usagelogger.usage()
Audit user actionslogger.audit()
Show progress for long opsDG.TaskBarProgressIndicator
Internal dev logging (not recorded)console.log() / console.warn()

Rules

  • Never use console.log for production logging — use DG.Logger for server-side or grok.shell.* for user-facing.
  • console.warn / console.error are acceptable for development diagnostics but won't be recorded on the server.
  • Prefer grok.shell.warning() over grok.shell.error() for non-critical issues (e.g., missing optional config).
  • Use grok.shell.error() for failures that block the user's workflow.
  • Use oneTimeKey when a notification could fire repeatedly (e.g., in a loop or event handler).

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Add support for a new curve data format in the Curves package converter system

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

datagrok-ai/public742026년 10월 20일 업데이트

Create info panels that appear in the context panel based on semantic types

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

datagrok-ai/public742026년 10월 20일 업데이트

Add a new single-objective optimization algorithm to the sci-comp library. Use when the user asks to implement a new optimizer (e.g. gradient descent, BFGS, simulated annealing, differential evolution).

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

datagrok-ai/public742026년 10월 20일 업데이트

Add unit tests to a Datagrok package

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

datagrok-ai/public742026년 10월 20일 업데이트

Answer a "how do I …" question about the platform with a Gherkin scenario on @datagrok-libraries/bdd that is filmed into a how-to video (grok-bdd guide), so the answer is demonstrated, sent as a video plus numbered steps, and kept as a regression test; the same scenarios, filmed in help mode, are the GIFs of the help pages

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

datagrok-ai/public742026년 10월 20일 업데이트

Translate hand-written Playwright specs (or any existing UI tests) into Gherkin features on @datagrok-libraries/bdd, then prove the features test what they claim by backward-matching them against the originals with independent reviewers, and fix the gaps in the core, the library and the features

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

datagrok-ai/public742026년 10월 20일 업데이트

datagrok-ai의 스킬 모두 보기

이 스킬의 문제 신고