pikku-pino

$npx mdskill add pikkujs/pikku/pikku-pino

Initialize PinoLogger for structured JSON logging in Pikku apps.

  • Enables developers to configure log levels and output structured JSON.
  • Depends on @pikku/pino package and implements the Logger interface.
  • Triggers only when PinoLogger is used or structured logging is requested.
  • Returns ready-to-use logger instances with standard logging methods.

SKILL.md

.github/skills/pikku-pinoView on GitHub ↗
---
name: pikku-pino
description: 'Use when setting up structured logging with Pino in a Pikku app. Covers PinoLogger setup and log levels.
TRIGGER when: code uses PinoLogger, user asks about structured logging, Pino, or @pikku/pino.
DO NOT TRIGGER when: user asks about ConsoleLogger (use pikku-services) or general service setup.'
---

# Pikku Pino (Structured Logging)

`@pikku/pino` provides structured JSON logging via [Pino](https://getpino.io/). Implements the `Logger` interface from `@pikku/core`.

## Installation

```bash
yarn add @pikku/pino
```

## API Reference

### `PinoLogger`

```typescript
import { PinoLogger } from '@pikku/pino'

const logger = new PinoLogger()
```

No constructor parameters. Creates a Pino logger instance.

**Properties:**
- `pino: pino.Logger` — Access the underlying Pino instance for advanced config.

**Methods:**
- `setLevel(level: LogLevel): void` — Set minimum log level.
- `info(messageOrObj: string | Record<string, any> | Error): void`
- `warn(messageOrObj: string | Record<string, any> | Error): void`
- `error(messageOrObj: string | Record<string, any> | Error): void`
- `debug(messageOrObj: string | Record<string, any>): void`

## Usage Patterns

### Basic Setup

```typescript
import { PinoLogger } from '@pikku/pino'

const logger = new PinoLogger()
logger.setLevel('debug')
```

### With Pikku Services

```typescript
const createSingletonServices = pikkuServices(async (config) => {
  const logger = new PinoLogger()
  return { config, logger }
})
```

### Accessing Underlying Pino

```typescript
const logger = new PinoLogger()
logger.pino.child({ module: 'auth' }).info('Token verified')
```

More from pikkujs/pikku

SkillDescription
pikku-addon'Use when creating or consuming reusable function packages (addons) in Pikku. Covers wireAddon, addon(), pikkuAddonServices, pikkuAddonWireServices, addon package structure, and cross-project function sharing.
pikku-ai-agent'Use when building AI agents, chatbots, or LLM-powered assistants with Pikku. Covers pikkuAIAgent, tool registration, memory, streaming, and agent invocation.
pikku-ai-vercel'Use when setting up AI agent execution with the Vercel AI SDK in a Pikku app. Covers VercelAIAgentRunner for streaming and non-streaming AI agent steps.
pikku-ai-voice'Use when adding voice input (speech-to-text) or voice output (text-to-speech) to AI agents in a Pikku app. Covers voiceInput/voiceOutput middleware hooks and STT/TTS service interfaces.
pikku-auth-js'Use when integrating Auth.js (NextAuth) with a Pikku app. Covers createAuthHandler, createAuthRoutes, and Auth.js configuration.
pikku-aws'Use when setting up AWS services (S3, SQS, Secrets Manager) in a Pikku app. Covers S3Content for file storage, SQSQueueService for queues, and AWSSecrets for secret management.
pikku-backblaze'Use when setting up Backblaze B2 file storage in a Pikku app. Covers B2Content for file uploads, downloads, and signed URLs.
pikku-cli'Use when building CLI commands with Pikku. Covers wireCLI, pikkuCLICommand, subcommands, options, parameters, custom renderers, and nested command groups.
pikku-concepts'Foundational guide to Pikku framework concepts. Use this skill when working with any Pikku codebase, starting a new Pikku project, or migrating a backend to Pikku. Covers the core mental model, function types, project structure, code generation, testing, and how Pikku maps to traditional backend patterns.
pikku-config'Use when managing secrets, environment variables, config, or OAuth2 credentials in a Pikku app. Covers wireSecret, wireVariable, wireOAuth2Credential, and typed config access.