open-index/open-npm huggingface dataset:
npm package: @loglayer/transport-aws-lambda-powertools
Description: AWS Lambda Powertools logger transport for the LogLayer logging library
Author: Theo Gravity
Latest version: 4.0.2

# AWS Lambda Powertools Logger Transport for LogLayer

[![NPM Version](https://img.shields.io/npm/v/%40loglayer%2Ftransport-aws-lambda-powertools)](https://www.npmjs.com/package/@loglayer/transport-aws-lambda-powertools)
[![NPM Downloads](https://img.shields.io/npm/dm/%40loglayer%2Ftransport-aws-lambda-powertools)](https://www.npmjs.com/package/@loglayer/transport-aws-lambda-powertools)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)

A transport for the [LogLayer](https://loglayer.dev) logging library using the [AWS Lambda Powertools Logger](https://docs.powertools.aws.dev/lambda/typescript/latest/core/logger/).

## Installation

```bash
npm install loglayer @loglayer/transport-aws-lambda-powertools @aws-lambda-powertools/logger
```

## Usage

```typescript
import { Logger } from '@aws-lambda-powertools/logger';
import { LogLayer } from 'loglayer';
import { PowertoolsTransport } from '@loglayer/transport-aws-lambda-powertools';

// Note: The Logger utility must always be instantiated outside the Lambda handler
// Create a new Powertools logger instance
const powertoolsLogger = new Logger({
  serviceName: 'my-service',
  logLevel: 'INFO'
});

// Create LogLayer instance with Powertools transport
const log = new LogLayer({
  transport: new PowertoolsTransport({
    logger: powertoolsLogger
  })
});

// Use LogLayer as normal
log.withMetadata({ customField: 'value' }).info('Hello from Lambda!');
```

## Log Level Mapping

| LogLayer | Powertools |
|----------|------------|
| trace    | DEBUG      |
| debug    | DEBUG      |
| info     | INFO       |
| warn     | WARN       |
| error    | ERROR      |
| fatal    | ERROR      |

## License

MIT
npm package: @loglayer/transport-axiom
Description: Axiom.co transport for the LogLayer logging library.
Author: Theo Gravity
Latest version: 3.0.2

# Axiom Transport for LogLayer

[![NPM Version](https://img.shields.io/npm/v/%40loglayer%2Ftransport-axiom)](https://www.npmjs.com/package/@loglayer/transport-axiom)
[![NPM Downloads](https://img.shields.io/npm/dm/%40loglayer%2Ftransport-axiom)](https://www.npmjs.com/package/@loglayer/transport-axiom)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)

A transport for sending logs to [Axiom.co](https://axiom.co) with the [LogLayer](https://loglayer.dev) logging library.

## Installation

```bash
npm install @loglayer/transport-axiom @axiomhq/js serialize-error loglayer
```

## Usage

```typescript
import { LogLayer } from 'loglayer';
import { serializeError } from 'serialize-error';
import { AxiomTransport } from '@loglayer/transport-axiom';
import { Axiom } from '@axiomhq/js';

// Create the Axiom client
const axiom = new Axiom({
  token: process.env.AXIOM_TOKEN,
  // Optional: other Axiom client options
  // orgId: 'your-org-id',
  // url: 'https://cloud.axiom.co',
});

// Create the LogLayer instance with AxiomTransport
const logger = new LogLayer({
  errorSerializer: serializeError,
  transport: new AxiomTransport({
    logger: axiom,
    dataset: 'your-dataset',
  }),
});

logger.info('Hello world');
```

## Documentation

For configuration options and examples, visit [https://loglayer.dev/transports/axiom](https://loglayer.dev/transports/axiom)
npm package: @loglayer/transport-betterstack
Description: Better Stack transport for the LogLayer logging library.
Author: Theo Gravity
Latest version: 2.0.3

# @loglayer/transport-betterstack

[![npm version](https://img.shields.io/npm/v/@loglayer/transport-betterstack.svg)](https://www.npmjs.com/package/@loglayer/transport-betterstack)
[![npm downloads](https://img.shields.io/npm/dm/@loglayer/transport-betterstack.svg)](https://www.npmjs.com/package/@loglayer/transport-betterstack)
[![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue.svg)](https://www.typescriptlang.org/)

Better Stack transport for the LogLayer logging library. This transport sends logs to [Better Stack's log management platform](https://betterstack.com/log-management) using their HTTP API.

## Installation

```bash
npm install @loglayer/transport-betterstack
```

```bash
yarn add @loglayer/transport-betterstack
```

```bash
pnpm add @loglayer/transport-betterstack
```

## Usage

- Create a "Javascript / Node.js" log source in your Better Stack account.
- In the "Data ingestion" tab of your source, find your `source token` and the `ingesting host`.
- Add `https://` in front of the ingesting host for the `url` parameter. 

```typescript
import { LogLayer } from "loglayer";
import { BetterStackTransport } from "@loglayer/transport-betterstack";

const transport = new BetterStackTransport({
  sourceToken: "<source token>",
  url: "https://<ingesting host>",
});

const log = new LogLayer({ transport });

log.info("Hello, Better Stack!");
log.withMetadata({ userId: "123" }).info("User logged in");
```

## Configuration

For detailed configuration options and advanced usage, see the [Better Stack transport documentation](https://loglayer.dev/transports/betterstack).
npm package: @loglayer/transport-bunyan
Description: Bunyan transport for the LogLayer logging library.
Author: Theo Gravity
Latest version: 3.0.2

# Bunyan Transport for LogLayer

[![NPM Version](https://img.shields.io/npm/v/%40loglayer%2Ftransport-bunyan)](https://www.npmjs.com/package/@loglayer/transport-bunyan)
[![NPM Downloads](https://img.shields.io/npm/dm/%40loglayer%2Ftransport-bunyan)](https://www.npmjs.com/package/@loglayer/transport-bunyan)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)

The Bunyan transport for the [LogLayer](https://loglayer.dev) logging library.

[Bunyan](https://github.com/trentm/node-bunyan) is a JSON logging library for Node.js services.

## Installation

```bash
npm install loglayer @loglayer/transport-bunyan bunyan
```

## Usage

```typescript
import bunyan from 'bunyan'
import { LogLayer } from 'loglayer'
import { BunyanTransport } from "@loglayer/transport-bunyan"

const b = bunyan.createLogger({
  name: "my-logger",
  level: "trace",  // Show all log levels
  serializers: { 
    err: bunyan.stdSerializers.err  // Use Bunyan's error serializer
  }
})

const log = new LogLayer({
  errorFieldName: "err",  // Match Bunyan's error field name
  transport: new BunyanTransport({
    logger: b
  })
})
```

## Documentation

For more details, visit [https://loglayer.dev/transports/bunyan](https://loglayer.dev/transports/bunyan)
npm package: @loglayer/transport-consola
Description: consola transport for the LogLayer logging library.
Author: Theo Gravity
Latest version: 3.0.2

# Consola Transport for LogLayer

[![NPM Version](https://img.shields.io/npm/v/%40loglayer%2Ftransport-consola)](https://www.npmjs.com/package/@loglayer/transport-consola)
[![NPM Downloads](https://img.shields.io/npm/dm/%40loglayer%2Ftransport-consola)](https://www.npmjs.com/package/@loglayer/transport-consola)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)

The Consola transport for the [LogLayer](https://loglayer.dev) logging library.

[Consola](https://github.com/unjs/consola) is an elegant and configurable console logger for Node.js and browser.

## Installation

```bash
npm install loglayer @loglayer/transport-consola consola
```

## Usage

```typescript
import { createConsola } from 'consola'
import { LogLayer } from 'loglayer'
import { ConsolaTransport } from "@loglayer/transport-consola"

const log = new LogLayer({
  transport: new ConsolaTransport({
    logger: createConsola({
      level: 5  // Enable all log levels
    })
  })
})
```

## Important Notes

- The default log level is `3` which excludes `debug` and `trace`
- Set level to `5` to enable all log levels

## Documentation

For more details, visit [https://loglayer.dev/transports/consola](https://loglayer.dev/transports/consola)
npm package: @loglayer/transport-cribl-http
Description: Cribl HTTP/S transport for the LogLayer logging library.
Author: Theo Gravity
Latest version: 1.0.0

# Cribl HTTP/S Transport for LogLayer

[![NPM Version](https://img.shields.io/npm/v/%40loglayer%2Ftransport-cribl-http)](https://www.npmjs.com/package/@loglayer/transport-cribl-http)
[![NPM Downloads](https://img.shields.io/npm/dm/%40loglayer%2Ftransport-cribl-http)](https://www.npmjs.com/package/@loglayer/transport-cribl-http)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)

A Cribl HTTP/S transport for the [LogLayer](https://loglayer.dev) logging library.

Ships logs to [Cribl Stream](https://cribl.io) via the [HTTP/S Bulk API source](https://docs.cribl.io/stream/sources-https/) (`/cribl/_bulk`). Features include:
- Automatic Cribl HTTP/S Bulk API JSON format
- Built on top of the robust HTTP transport
- Retry logic with exponential backoff
- Rate limiting support
- Batch sending with configurable size and timeout
- Error and debug callbacks

## Installation

```bash
npm install loglayer @loglayer/transport-cribl-http serialize-error
```

## Usage

```typescript
import { LogLayer } from 'loglayer'
import { CriblTransport } from "@loglayer/transport-cribl-http"
import { serializeError } from "serialize-error";

const log = new LogLayer({
  errorSerializer: serializeError,
  transport: new CriblTransport({
    url: "https://your-cribl-instance:10080",
    token: "YOUR-AUTH-TOKEN",
    source: "my-app",
    host: "server-01",
  })
})

// Use the logger
log.info("This is a test message");
log.withMetadata({ userId: "123" }).error("User not found");
```

## Documentation

For more details, visit [https://loglayer.dev/transports/cribl](https://loglayer.dev/transports/cribl)
npm package: @loglayer/transport-datadog
Description: DataDog transport for the LogLayer logging library.
Author: Theo Gravity
Latest version: 4.0.2

# Datadog Transport for LogLayer

[![NPM Version](https://img.shields.io/npm/v/%40loglayer%2Ftransport-datadog)](https://www.npmjs.com/package/@loglayer/transport-datadog)
[![NPM Downloads](https://img.shields.io/npm/dm/%40loglayer%2Ftransport-datadog)](https://www.npmjs.com/package/@loglayer/transport-datadog)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)

The DataDog transport for the [LogLayer](https://loglayer.dev) logging library.

Ships logs to DataDog using the [datadog-transport-common](https://www.npmjs.com/package/datadog-transport-common) library.

## Important Notes

- Only works server-side (not in browsers)
  * For browser-side logging, use the [`@loglayer/transport-datadog-browser-logs`](https://github.com/loglayer/loglayer/tree/master/packages/transports/datadog-browser-logs) package
- You will not get any console output since this sends directly to DataDog. Use the `onDebug` option to log out messages.

## Installation

```bash
npm install loglayer @loglayer/transport-datadog serialize-error
```

## Usage

```typescript
import { LogLayer } from 'loglayer'
import { DataDogTransport } from "@loglayer/transport-datadog"
import { serializeError } from "serialize-error";

const log = new LogLayer({
  errorSerializer: serializeError,
  transport: new DataDogTransport({
    options: {
      ddClientConf: {
        authMethods: {
          apiKeyAuth: "YOUR_API_KEY",
        },
      },
      ddServerConf: {
        // Note: This must match the site you use for your DataDog login - See below for more info
        site: "datadoghq.eu"
      },
      onDebug: (msg) => {
        console.log(msg);
      },
      onError: (err, logs) => {
        console.error(err, logs);
      },
    },
  })
})
```

See the [documentation](https://loglayer.dev/transports/datadog) for more information.
npm package: @loglayer/transport-datadog-browser-logs
Description: Datadog Browser Logs transport for the LogLayer logging library.
Author: Theo Gravity
Latest version: 3.0.2

# Datadog Browser Logs Transport for LogLayer

[![NPM Version](https://img.shields.io/npm/v/%40loglayer%2Ftransport-datadog-browser-logs)](https://www.npmjs.com/package/@loglayer/transport-datadog-browser-logs)
[![NPM Downloads](https://img.shields.io/npm/dm/%40loglayer%2Ftransport-datadog-browser-logs)](https://www.npmjs.com/package/@loglayer/transport-datadog-browser-logs)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)

The Datadog Browser Logs transport for the [LogLayer](https://loglayer.dev) logging library.

[@datadog/browser-logs](https://docs.datadoghq.com/logs/log_collection/javascript/) is Datadog's official browser-side logging library.

## Important Notes

- Only works in browser environments (not in Node.js)
    * For server-side logging, use the `@loglayer/transport-datadog` package
- You will not get any console output since this sends directly to DataDog. 

## Installation

```bash
npm install loglayer @loglayer/transport-datadog-browser-logs @datadog/browser-logs
```

## Usage

```typescript
import { datadogLogs } from '@datadog/browser-logs'
import { LogLayer } from 'loglayer'
import { DataDogBrowserLogsTransport } from "@loglayer/transport-datadog-browser-logs"

// Initialize Datadog
datadogLogs.init({
  clientToken: '<CLIENT_TOKEN>',
  site: '<DATADOG_SITE>',
  forwardErrorsToLogs: true,
  sampleRate: 100
})

const log = new LogLayer({
  transport: new DataDogBrowserLogsTransport({
    logger: datadogLogs.logger
  })
})
```

## Documentation

For more details, visit [https://loglayer.dev/transports/datadog-browser-logs](https://loglayer.dev/transports/datadog)
npm package: @loglayer/transport-dynatrace
Description: Dynatrace transport for the LogLayer logging library.
Author: Theo Gravity
Latest version: 3.0.2

# Dynatrace Transport for LogLayer

[![NPM Version](https://img.shields.io/npm/v/%40loglayer%2Ftransport-dynatrace)](https://www.npmjs.com/package/@loglayer/transport-dynatrace)
[![NPM Downloads](https://img.shields.io/npm/dm/%40loglayer%2Ftransport-dynatrace)](https://www.npmjs.com/package/@loglayer/transport-dynatrace)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)

A transport for the [LogLayer](https://loglayer.dev) logging library to send logs to Dynatrace using their [Log Monitoring API v2](https://docs.dynatrace.com/docs/discover-dynatrace/references/dynatrace-api/environment-api/log-monitoring-v2/post-ingest-logs).

## Installation

```bash
npm install loglayer @loglayer/transport-dynatrace serialize-error
```

## Quick Start

You will need an access token with the `logs.ingest` scope. See [access token documentation](https://docs.dynatrace.com/docs/discover-dynatrace/references/dynatrace-api/basics/dynatrace-api-authentication) for more details.

```typescript
import { LogLayer } from 'loglayer'
import { DynatraceTransport } from "@loglayer/transport-dynatrace"

const log = new LogLayer({
  errorSerializer: serializeError,
  transport: new DynatraceTransport({
    url: "https://your-environment-id.live.dynatrace.com/api/v2/logs/ingest",
    ingestToken: "your-api-token",
    onError: (error) => console.error('Failed to send log:', error)
  })
})

log.info('Hello world')
```

## Documentation

For more details, visit [https://loglayer.dev/transports/dynatrace](https://loglayer.dev/transports/dynatrace)
npm package: @loglayer/transport-electron-log
Description: electron-log transport for the LogLayer logging library.
Author: Theo Gravity
Latest version: 3.0.2

# Electron-log Transport for LogLayer

[![NPM Version](https://img.shields.io/npm/v/%40loglayer%2Ftransport-electron-log)](https://www.npmjs.com/package/@loglayer/transport-electron-log)
[![NPM Downloads](https://img.shields.io/npm/dm/%40loglayer%2Ftransport-electron-log)](https://www.npmjs.com/package/@loglayer/transport-electron-log)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)

Electron-log transport for the [LogLayer](https://loglayer.dev) logging library.

[Electron-log](https://github.com/megahertz/electron-log) is a logging library designed specifically for Electron applications.

## Installation

```bash
npm install loglayer @loglayer/transport-electron-log electron-log
```

## Usage

```typescript
// Main process logger
import log from 'electron-log/src/main'
// Or for Renderer process
// import log from 'electron-log/src/renderer'
import { LogLayer } from 'loglayer'
import { ElectronLogTransport } from "@loglayer/transport-electron-log"

const logger = new LogLayer({
  transport: new ElectronLogTransport({
    logger: log
  })
})
```

## Documentation

For more details, visit [https://loglayer.dev/transports/electron-log](https://loglayer.dev/transports/electron-log)
npm package: @loglayer/transport-log-file-rotation
Description: Log file rotation transport for the LogLayer logging library.
Author: Theo Gravity
Latest version: 3.0.2

# @loglayer/transport-log-file-rotation

[![NPM Version](https://img.shields.io/npm/v/%40loglayer%2Ftransport-log-file-rotation)](https://www.npmjs.com/package/@loglayer/transport-log-file-rotation)
[![NPM Downloads](https://img.shields.io/npm/dm/%40loglayer%2Ftransport-log-file-rotation)](https://www.npmjs.com/package/@loglayer/transport-log-file-rotation)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)

A transport for the [LogLayer](https://loglayer.dev) logging library that writes logs to files with automatic rotation based on size or time. Built on top of [file-stream-rotator](https://github.com/rogerc/file-stream-rotator/).

## Features

- Automatic log file rotation based on time (hourly, daily)
- Size-based rotation with support for KB, MB, and GB units
- Support for date patterns in filenames using numerical values
- Compression of rotated log files using gzip
- Maximum file count or age-based retention
- Automatic cleanup of old log files
- Batch processing of logs for improved performance

## Installation

```sh
# npm
npm i loglayer @loglayer/transport-log-file-rotation serialize-error

# pnpm
pnpm add loglayer @loglayer/transport-log-file-rotation serialize-error

# yarn
yarn add loglayer @loglayer/transport-log-file-rotation serialize-error
```

## Usage

```typescript
import { LogLayer } from "loglayer";
import { LogFileRotationTransport } from "@loglayer/transport-log-file-rotation";
import { serializeError } from "serialize-error";

const logger = new LogLayer({
  errorSerializer: serializeError,
  transport: [
    new LogFileRotationTransport({
      filename: "./logs/app.log",
    }),
  ],
});

logger.info("Application started");
```

### Filename Uniqueness
Each instance of `LogFileRotationTransport` must have a unique filename to prevent possible race conditions. If you try to create multiple transport instances with the same filename, an error will be thrown. If you need multiple loggers to write to the same file, they should share the same transport instance:

```typescript
// Create a single transport instance
const fileTransport = new LogFileRotationTransport({
  filename: "./logs/app-%DATE%.log",
  dateFormat: "YMD",
  frequency: "daily"
});

// Share it between multiple loggers
const logger1 = new LogLayer({
  transport: [fileTransport]
});

const logger2 = new LogLayer({
  transport: [fileTransport]
});
```

Child loggers do not have this problem as they inherit the transport instance from their parent logger.

## Documentation

For detailed documentation, including all configuration options and advanced features, visit the [documentation](https://loglayer.dev/transports/log-file-rotation.html).
npm package: @loglayer/transport-log4js
Description: log4js transport for the LogLayer logging library.
Author: Theo Gravity
Latest version: 3.0.2

# Log4js Transport for LogLayer

[![NPM Version](https://img.shields.io/npm/v/%40loglayer%2Ftransport-log4js)](https://www.npmjs.com/package/@loglayer/transport-log4js)
[![NPM Downloads](https://img.shields.io/npm/dm/%40loglayer%2Ftransport-log4js)](https://www.npmjs.com/package/@loglayer/transport-log4js)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)

The Log4js transport for the [LogLayer](https://loglayer.dev) logging library.

[Log4js-node](https://log4js-node.github.io/log4js-node/) is a conversion of the Log4j framework to Node.js.

## Important Notes

- Log4js only works in Node.js environments (not in browsers)
- By default, logging is disabled and must be configured via `level` or advanced configuration
- Consider using Winston as an alternative if Log4js configuration is too complex

## Installation

```bash
npm install loglayer @loglayer/transport-log4js log4js
```

## Usage

```typescript
import log4js from 'log4js'
import { LogLayer } from 'loglayer'
import { Log4JsTransport } from "@loglayer/transport-log4js"

const logger = log4js.getLogger()

// Enable logging output
logger.level = "trace"

const log = new LogLayer({
  transport: new Log4JsTransport({
    logger
  })
})
```

## Documentation

For more details, visit [https://loglayer.dev/transports/log4js](https://loglayer.dev/transports/log4js)
npm package: @loglayer/transport-logflare
Description: Logflare transport for the LogLayer logging library.
Author: Theo Gravity
Latest version: 2.0.3

# Logflare Transport for LogLayer

[![NPM Version](https://img.shields.io/npm/v/%40loglayer%2Ftransport-logflare)](https://www.npmjs.com/package/@loglayer/transport-logflare)
[![NPM Downloads](https://img.shields.io/npm/dm/%40loglayer%2Ftransport-logflare)](https://www.npmjs.com/package/@loglayer/transport-logflare)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)

A Logflare transport for the [LogLayer](https://loglayer.dev) logging library.

Ships logs to [Logflare](https://logflare.app) using the HTTP transport with Logflare-specific configuration. Features include:
- Automatic Logflare JSON format
- Built on top of the robust HTTP transport
- Retry logic with exponential backoff
- Rate limiting support
- Batch sending with configurable size and timeout
- Error and debug callbacks
- Support for self-hosted Logflare instances

## Installation

```bash
npm install loglayer @loglayer/transport-logflare serialize-error
```

## Usage

```typescript
import { LogLayer } from 'loglayer'
import { LogflareTransport } from "@loglayer/transport-logflare"
import { serializeError } from "serialize-error";

const log = new LogLayer({
  errorSerializer: serializeError,
  contextFieldName: null, // recommended based on testing
  metadataFieldName: null, // recommended based on testing
  transport: new LogflareTransport({
    sourceId: "YOUR-SOURCE-ID",
    apiKey: "YOUR-API-KEY",

  })
})

// Use the logger
log.info("This is a test message");
log.withMetadata({ userId: "123" }).error("User not found");
```

## Documentation

For more details, visit [https://loglayer.dev/transports/logflare](https://loglayer.dev/transports/logflare)
npm package: @loglayer/transport-loglevel
Description: loglevel transport for the LogLayer logging library.
Author: Theo Gravity
Latest version: 3.0.2

# loglevel Transport for LogLayer

[![NPM Version](https://img.shields.io/npm/v/%40loglayer%2Ftransport-loglevel)](https://www.npmjs.com/package/@loglayer/transport-loglevel)
[![NPM Downloads](https://img.shields.io/npm/dm/%40loglayer%2Ftransport-loglevel)](https://www.npmjs.com/package/@loglayer/transport-loglevel)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)

A transport for using [loglevel](https://github.com/pimterry/loglevel) with the [LogLayer](https://loglayer.dev) logging library.

## Installation

```bash
npm install @loglayer/transport-loglevel loglevel
```

## Usage

```typescript
import { LogLayer } from 'loglayer';
import { LogLevelTransport } from '@loglayer/transport-loglevel';
import log from 'loglevel';

const logger = log.getLogger('myapp');
logger.setLevel('trace'); // Enable all log levels

const loglayer = new LogLayer({
  transport: new LogLevelTransport({
    logger,
    // Optional: control where object data appears in log messages
    appendObjectData: false // default: false - object data appears first
  })
});

loglayer.info('Hello world');
```

## Configuration Options

### `appendObjectData`

Controls where object data (metadata, context, errors) appears in the log messages:
- `false` (default): Object data appears as the first parameter
- `true`: Object data appears as the last parameter

Example with `appendObjectData: false` (default):
```typescript
loglayer.withMetadata({ user: 'john' }).info('User logged in');
// logger.info({ user: 'john' }, 'User logged in')
```

Example with `appendObjectData: true`:
```typescript
loglayer.withMetadata({ user: 'john' }).info('User logged in');
// logger.info('User logged in', { user: 'john' })
```

## Log Level Mapping

| LogLayer | LogLevel |
|----------|----------|
| trace    | trace    |
| debug    | debug    |
| info     | info     |
| warn     | warn     |
| error    | error    |
| fatal    | error    |
npm package: @loglayer/transport-logtape
Description: LogTape transport for the LogLayer logging library.
Author: Theo Gravity
Latest version: 2.0.2

# LogTape Transport for LogLayer

[![NPM Version](https://img.shields.io/npm/v/%40loglayer%2Ftransport-logtape)](https://www.npmjs.com/package/@loglayer/transport-logtape)
[![NPM Downloads](https://img.shields.io/npm/dm/%40loglayer%2Ftransport-logtape)](https://www.npmjs.com/package/@loglayer/transport-logtape)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)

The LogTape transport for the [LogLayer](https://loglayer.dev) logging library.

[LogTape](https://logtape.org) is a modern, structured logging library for TypeScript and JavaScript with support for multiple sinks, filters, and adapters.

## Installation

```bash
npm install loglayer @loglayer/transport-logtape @logtape/logtape
```

## Usage

```typescript
import { configure, getConsoleSink, getLogger } from '@logtape/logtape'
import { LogLayer } from 'loglayer'
import { LogTapeTransport } from "@loglayer/transport-logtape"

// Configure LogTape
await configure({
  sinks: { console: getConsoleSink() },
  loggers: [
    { category: "my-app", lowestLevel: "debug", sinks: ["console"] }
  ]
})

// Get a LogTape logger instance
const logtapeLogger = getLogger(["my-app", "my-module"])

const log = new LogLayer({
  transport: new LogTapeTransport({
    logger: logtapeLogger
  })
})
```

## Documentation

For more details, visit [https://loglayer.dev/transports/logtape](https://loglayer.dev/transports/logtape)
npm package: @loglayer/transport-opentelemetry
Description: OpenTelemetry transport for LogLayer for use with log processors.
Author: Theo Gravity
Latest version: 4.0.2

# OpenTelemetry Transport for LogLayer

[![NPM Version](https://img.shields.io/npm/v/%40loglayer%2Ftransport-opentelemetry)](https://www.npmjs.com/package/@loglayer/transport-opentelemetry)
[![NPM Downloads](https://img.shields.io/npm/dm/%40loglayer%2Ftransport-opentelemetry)](https://www.npmjs.com/package/@loglayer/transport-opentelemetry)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)

Transport for the [LogLayer](https://loglayer.dev) logging library for sending logs using the [OpenTelemetry Logs SDK](https://www.npmjs.com/package/@opentelemetry/sdk-logs). This allows you to integrate logs with OpenTelemetry's observability ecosystem.

Compatible with OpenTelemetry JS API and SDK `1.0+`.

### Note

In most cases, you should use the [OpenTelemetry Plugin](https://loglayer.dev/plugins/opentelemetry) instead as it stamps logs with trace context.
Use this transport if you are using OpenTelemetry log processors, where the log processors do the actual shipping of logs.

### Acknowledgements

A lot of the code is based on the [@opentelemetry/winston-transport](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/winston-transport) code,
which is licensed under Apache 2.0.

## Installation

```bash
npm install loglayer @loglayer/transport-opentelemetry serialize-error
```

## Usage

Follow the [OpenTelemetry Getting Started Guide](https://opentelemetry.io/docs/languages/js/getting-started/nodejs/) to set up OpenTelemetry in your application.

```typescript
import { LogLayer } from 'loglayer'
import { OpenTelemetryTransport } from '@loglayer/transport-opentelemetry'
import { serializeError } from 'serialize-error'

const logger = new LogLayer({
  // This will send logs to the OpenTelemetry SDK
  // Where it sends to depends on the configured logRecordProcessors in the SDK
  transport: [new OpenTelemetryTransport({
    // Optional: provide a custom error handler
    onError: (error) => console.error('OpenTelemetry logging error:', error),
    
    // Optional: disable the transport
    enabled: process.env.NODE_ENV !== 'test',
    
    // Optional: enable console debugging
    consoleDebug: process.env.DEBUG === 'true',

    // Optional: set minimum log level to process (defaults to 'trace')
    level: 'info'
  })],
  errorSerializer: serializeError,
});
```

## Documentation

For more details and examples, visit [https://loglayer.dev/transports/opentelemetry](https://loglayer.dev/transports/opentelemetry)
npm package: @loglayer/transport-pino
Description: Pino transport for the LogLayer logging library.
Author: Theo Gravity
Latest version: 3.0.2

# Pino Transport for LogLayer

[![NPM Version](https://img.shields.io/npm/v/%40loglayer%2Ftransport-pino)](https://www.npmjs.com/package/@loglayer/transport-pino)
[![NPM Downloads](https://img.shields.io/npm/dm/%40loglayer%2Ftransport-pino)](https://www.npmjs.com/package/@loglayer/transport-pino)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)

The Pino transport for the [LogLayer](https://loglayer.dev) logging library.

[Pino](https://github.com/pinojs/pino) is a very low overhead Node.js logger, focused on performance.

## Installation

```bash
npm install loglayer @loglayer/transport-pino pino
```

## Usage

```typescript
import { pino } from 'pino'
import { LogLayer } from 'loglayer'
import { PinoTransport } from "@loglayer/transport-pino"

const p = pino({
  level: 'trace'  // Enable all log levels
})

const log = new LogLayer({
  transport: new PinoTransport({
    logger: p
  })
})
```

## Documentation

For more details, visit [https://loglayer.dev/transports/pino](https://loglayer.dev/transports/pino)
npm package: @loglayer/transport-pretty-terminal
Description: Interactive pretty log output in the terminal for the LogLayer logging library.
Author: Theo Gravity
Latest version: 5.0.2

# Pretty Terminal Transport for LogLayer

[![NPM Version](https://img.shields.io/npm/v/%40loglayer%2Ftransport-pretty-terminal)](https://www.npmjs.com/package/@loglayer/transport-pretty-terminal)
[![NPM Downloads](https://img.shields.io/npm/dm/%40loglayer%2Ftransport-pretty-terminal)](https://www.npmjs.com/package/@loglayer/transport-pretty-terminal)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)

A transport for the [LogLayer](https://loglayer.dev) logging library that pretty-prints logs printed in the terminal.

![Pretty Terminal Transport](https://loglayer.dev/images/pretty-terminal/pretty-terminal-short-v2.gif)

## Features

- 🎨 **Color-coded Log Levels** - Each log level has distinct colors for quick visual identification
- 🔍 **Interactive Selection Mode** - Browse and inspect logs in a full-screen interactive view
- 📝 **Detailed Log Inspection** - Examine individual log entries with formatted data and context
- 🔎 **Search/Filter Functionality** - Find specific logs with powerful filtering capabilities
- 💅 **JSON Pretty Printing** - Beautifully formatted structured data with syntax highlighting
- 🎭 **Configurable Themes** - Choose from pre-built themes or customize your own colors

## Next.js / browser support

The Pretty Terminal does not work in a browser or Next.js as Pretty Terminal has dependencies that are incompatible with
in a Next.js environment.

Use [Simple Pretty terminal](https://loglayer.dev/transports/simple-pretty-terminal) instead.


## Installation

Visit the [Pretty Terminal docs](https://loglayer.dev/transports/pretty-terminal) for installation and usage.
npm package: @loglayer/transport-roarr
Description: roarr transport for the LogLayer logging library.
Author: Theo Gravity
Latest version: 4.0.2

# Roarr Transport for LogLayer

[![NPM Version](https://img.shields.io/npm/v/%40loglayer%2Ftransport-roarr)](https://www.npmjs.com/package/@loglayer/transport-roarr)
[![NPM Downloads](https://img.shields.io/npm/dm/%40loglayer%2Ftransport-roarr)](https://www.npmjs.com/package/@loglayer/transport-roarr)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)

The Roarr transport for the [LogLayer](https://loglayer.dev) logging library.

[Roarr](https://github.com/gajus/roarr) is a JSON logger for Node.js and browser environments.

## Installation

```bash
npm install loglayer @loglayer/transport-roarr roarr serialize-error
```

## Usage

### Node.js Environment Setup
```bash
ROARR_LOG=true node your-app.js
```

### Browser Environment Setup
```typescript
window.ROARR = {
  enabled: true
}
```

### Implementation
```typescript
import { Roarr as r } from 'roarr'
import { LogLayer } from 'loglayer'
import { RoarrTransport } from "@loglayer/transport-roarr"
import { serializeError } from 'serialize-error'

const log = new LogLayer({
  transport: new RoarrTransport({
    logger: r
  }),
  errorSerializer: serializeError  // Roarr requires error serialization
})
```

## Documentation

For more details, visit [https://loglayer.dev/transports/roarr](https://loglayer.dev/transports/roarr)
npm package: @loglayer/transport-sentry
Description: Sentry transport for the LogLayer logging library.
Author: Theo Gravity
Latest version: 2.0.2

# @loglayer/transport-sentry

[![npm version](https://img.shields.io/npm/v/@loglayer/transport-sentry.svg)](https://www.npmjs.com/package/@loglayer/transport-sentry)
[![npm downloads](https://img.shields.io/npm/dm/@loglayer/transport-sentry.svg)](https://www.npmjs.com/package/@loglayer/transport-sentry)
[![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue.svg)](https://www.typescriptlang.org/)

Sentry transport for the LogLayer logging library. This transport sends structured logs to Sentry using any Sentry logger instance.

## Installation

```bash
npm install @loglayer/transport-sentry serialize-error <sentry-sdk>
```

```bash
yarn add @loglayer/transport-sentry serialize-error <sentry-sdk>
```

```bash
pnpm add @loglayer/transport-sentry serialize-error <sentry-sdk>
```

Replace `<sentry-sdk>` with the appropriate Sentry SDK for your platform:

- **Browser**: [@sentry/browser](https://docs.sentry.io/platforms/javascript/logs/)
- **Next.js**: [@sentry/nextjs](https://docs.sentry.io/platforms/javascript/guides/nextjs/logs/)
- **Bun**: [@sentry/bun](https://docs.sentry.io/platforms/javascript/guides/bun/logs/)
- **Deno**: [@sentry/deno](https://docs.sentry.io/platforms/javascript/guides/deno/)
- **Node.js**: [@sentry/node](https://docs.sentry.io/platforms/javascript/guides/node/)

## Usage

```typescript
import { LogLayer } from "loglayer";
import { SentryTransport } from "@loglayer/transport-sentry";
import { serializeError } from "serialize-error";
// node.js example, but most of the JS-based SDKs follow this pattern
import * as Sentry from "@sentry/node";

// In most cases, you'll want to initialize at the top-most entrypoint
// to your app so Sentry can instrument your code, such as the index.ts file
Sentry.init({
  dsn: "YOUR_SENTRY_DSN",
  enableLogs: true,
});

const log = new LogLayer({
  errorSerializer: serializeError,
  transport: [
    new SentryTransport({
      logger: Sentry.logger,
    }),
  ],
});

// Use LogLayer as normal
log.withMetadata({ userId: 123 }).info("User logged in");
log.withError(new Error("Something went wrong")).error("Operation failed");
```

## Documentation

For more detailed documentation, visit the [LogLayer website](https://loglayer.dev/transports/sentry).
npm package: @loglayer/transport-signale
Description: Signale transport for the LogLayer logging library.
Author: Theo Gravity
Latest version: 3.0.2

# Signale Transport for LogLayer

[![NPM Version](https://img.shields.io/npm/v/%40loglayer%2Ftransport-signale)](https://www.npmjs.com/package/@loglayer/transport-signale)
[![NPM Downloads](https://img.shields.io/npm/dm/%40loglayer%2Ftransport-signale)](https://www.npmjs.com/package/@loglayer/transport-signale)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)

The Signale transport for the [LogLayer](https://loglayer.dev) logging library.

[Signale](https://github.com/klaussinani/signale) is a highly configurable logging utility designed for CLI applications.

## Important Notes

- Signale only works in Node.js environments (not in browsers)
- It is primarily designed for CLI applications
- LogLayer only integrates with standard log levels (not CLI-specific levels like `success`, etc.)

## Installation

```bash
npm install loglayer @loglayer/transport-signale signale
```

## Usage

```typescript
import { Signale } from 'signale'
import { LogLayer } from 'loglayer'
import { SignaleTransport } from "@loglayer/transport-signale"

const signale = new Signale()

const log = new LogLayer({
  transport: new SignaleTransport({
    logger: signale
  })
})
```

## Documentation

For more details, visit [https://loglayer.dev/transports/signale](https://loglayer.dev/transports/signale)
npm package: @loglayer/transport-simple-pretty-terminal
Description: Pretty log output in the terminal / browser / Next.js for the LogLayer logging library.
Author: Theo Gravity
Latest version: 3.0.2

# @loglayer/transport-simple-pretty-terminal

[![NPM Version](https://img.shields.io/npm/v/@loglayer/transport-simple-pretty-terminal)](https://www.npmjs.com/package/@loglayer/transport-simple-pretty-terminal)
[![Downloads](https://img.shields.io/npm/dm/@loglayer/transport-simple-pretty-terminal)](https://www.npmjs.com/package/@loglayer/transport-simple-pretty-terminal)
[![TypeScript](https://img.shields.io/badge/TypeScript-Yes-blue)](https://www.typescriptlang.org/)

A transport for the [LogLayer](https://loglayer.dev) logging library that pretty-prints logs printed in the terminal.

[Pretty terminal](https://loglayer.dev/transports/pretty-terminal)'s simpler cousin with no interactive features. Designed for use with Next.js and apps running concurrently. Supports both Node.js and browser environments.

![Simple Pretty Terminal Transport](https://loglayer.dev/images/simple-pretty-terminal/terminal-inline.webp)

## Features

- 🎨 **Color-coded Log Levels** - Each log level has distinct colors for quick visual identification
- 💅 **JSON Pretty Printing** - Beautifully formatted structured data with syntax highlighting
- 🎭 **Configurable Themes** - Choose from pre-built themes or customize your own colors
- 🌐 **Browser & Node.js Support** - Works in both Node.js and browser environments

## Installation

Visit the [Simple Pretty Terminal docs](https://loglayer.dev/transports/simple-pretty-terminal) for installation and usage.
npm package: @loglayer/transport-sumo-logic
Description: Sumo Logic transport for the LogLayer logging library.
Author: Theo Gravity
Latest version: 3.0.2

# Sumo Logic Transport for LogLayer

[![NPM Version](https://img.shields.io/npm/v/%40loglayer%2Ftransport-sumo-logic)](https://www.npmjs.com/package/@loglayer/transport-sumo-logic)
[![NPM Downloads](https://img.shields.io/npm/dm/%40loglayer%2Ftransport-sumo-logic)](https://www.npmjs.com/package/@loglayer/transport-sumo-logic)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)

A transport to send logs to Sumo Logic via [HTTP Source](https://help.sumologic.com/docs/send-data/hosted-collectors/http-source/logs-metrics/upload-logs/) for the [LogLayer](https://loglayer.dev) logging library.

## Installation

```bash
npm install @loglayer/transport-sumo-logic serialize-error
# or
yarn add @loglayer/transport-sumo-logic serialize-error
# or
pnpm add @loglayer/transport-sumo-logic serialize-error
```

## Usage

```typescript
import { LogLayer } from "loglayer";
import { SumoLogicTransport } from "@loglayer/transport-sumo-logic";
import { serializeError } from "serialize-error";

const transport = new SumoLogicTransport({
  url: "YOUR_SUMO_LOGIC_HTTP_SOURCE_URL",
});

const logger = new LogLayer({
  errorSerializer: serializeError,
  transport
});

// Basic logging
logger.info("Hello from LogLayer!");
```

## Documentation

For more details, visit [https://loglayer.dev/transports/sumo-logic](https://loglayer.dev/transports/sumo-logic)
npm package: @loglayer/transport-tracer
Description: tracer transport for the LogLayer logging library.
Author: Theo Gravity
Latest version: 3.0.2

# Tracer Transport for LogLayer

[![NPM Version](https://img.shields.io/npm/v/%40loglayer%2Ftransport-tracer)](https://www.npmjs.com/package/@loglayer/transport-tracer)
[![NPM Downloads](https://img.shields.io/npm/dm/%40loglayer%2Ftransport-tracer)](https://www.npmjs.com/package/@loglayer/transport-tracer)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)

The Tracer transport for the [LogLayer](https://loglayer.dev) logging library.

[tracer](https://www.npmjs.com/package/tracer) is a powerful and customizable logging library for node.js.

## Installation

```bash
npm install loglayer @loglayer/transport-tracer tracer
```

## Usage

```typescript
import { LogLayer } from 'loglayer'
import { TracerTransport } from '@loglayer/transport-tracer'
import tracer from 'tracer'

const logger = tracer.console()

const log = new LogLayer({
  transport: new TracerTransport({
    id: 'tracer',
    logger
  })
})
```

## Documentation

For more details, visit [https://loglayer.dev/transports/tracer](https://loglayer.dev/transports/tracer)
npm package: @loglayer/transport-tslog
Description: tslog transport for the LogLayer logging library.
Author: Theo Gravity
Latest version: 4.0.2

# tslog Transport for LogLayer

[![NPM Version](https://img.shields.io/npm/v/%40loglayer%2Ftransport-tslog)](https://www.npmjs.com/package/@loglayer/transport-tslog)
[![NPM Downloads](https://img.shields.io/npm/dm/%40loglayer%2Ftransport-tslog)](https://www.npmjs.com/package/@loglayer/transport-tslog)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)

The tslog transport for the [LogLayer](https://loglayer.dev) logging library.

[tslog](https://tslog.js.org/) provides powerful, fast and expressive logging for TypeScript and JavaScript.

## Installation

```bash
npm install loglayer @loglayer/transport-tslog tslog
```

## Usage

```typescript
import { LogLayer } from 'loglayer'
import { TracerTransport } from '@loglayer/transport-tslog'
import { Logger, ILogObj } from "tslog";

const tslog: Logger<ILogObj> = new Logger();

const log = new LogLayer({
  transport: new TsLogTransport({
    logger: tslog,
  })
})
```

## Documentation

For more details, visit [https://loglayer.dev/transports/tslog](https://loglayer.dev/transports/tslog)
npm package: @loglayer/transport-winston
Description: Winston transport for the LogLayer logging library.
Author: Theo Gravity
Latest version: 3.0.2

# Winston Transport for LogLayer

[![NPM Version](https://img.shields.io/npm/v/%40loglayer%2Ftransport-winston)](https://www.npmjs.com/package/@loglayer/transport-winston)
[![NPM Downloads](https://img.shields.io/npm/dm/%40loglayer%2Ftransport-winston)](https://www.npmjs.com/package/@loglayer/transport-winston)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)

The Winston transport for the [LogLayer](https://loglayer.dev) logging library.

[Winston](https://github.com/winstonjs/winston) A logger for just about everything.

## Installation

```bash
npm install loglayer @loglayer/transport-winston winston
```

## Usage

```typescript
import winston from 'winston'
import { LogLayer } from 'loglayer'
import { WinstonTransport } from "@loglayer/transport-winston"

const w = winston.createLogger({})

const log = new LogLayer({
  transport: new WinstonTransport({
    logger: w
  })
})
```

## Documentation

For more details, visit [https://loglayer.dev/transports/winston](https://loglayer.dev/transports/winston)
npm package: @logluarx/webpack-theme-color-replacer
Description: 基于webpack-theme-color-replacer,处理antd样式和qiankun对接. A webpack plugin designed to dynamicly change the theme colors at runtime. 实现运行时快速动态替换主题色的webpack插件. 
Author: James.Huang
Latest version: 1.5.2

README.md