open-index/open-npm huggingface dataset:
npm package: @rdtask/logger
Description: Logger shared across multiple apps internally
Latest version: 1.0.1

# Logger Package

This package provides a logger and a request logger utility built using [Winston](https://github.com/winstonjs/winston). It offers customizable log levels using env and supports structured logging for general application logs and HTTP requests.

## Features.
- Dynamic log level configuration using env.
- Pre-configured winston logger for general usage (`logger`).
- Request logger middleware that logs incoming request

## Usage

### Adding as a package
Add this package as a dependency in package.json
```typescript
dependency: {
    ...
    @rdtask/logger":"*",
    ...
}
```

### Importing the Logger
```typescript
import { logger, requestLogger } from '@rdtask/logger'
```
### Usage
### `logger`: General Logger
Use this for general application logs.

```typescript
logger.info("This is an info log");
logger.warn("This is a warning");
logger.error("This is an error");
```

### `requestLogger`: Request Logger Middleware
Use this as a middleware for incoming requests

```typescript
const app = express()
app.use(requestLogger)
```

## Available Log Levels
- `error`
- `warn`
- `info` (default)
- `http`
- `verbose`
- `debug`
- `silly`

## Log file
- Log files are stored in logs folder of current working directory. Error logs are stored in files with format `error-%DATE%.log` and combined logs are stored with format `combined-%DATE%.log`. 
- Log files have a 7 day rotation period defined.

## Configuration
- By default, the log level is set to `info`. 
- You can specify a log level by adding a LOG_LEVEL in .env.
npm package: @rdub/base
Description: JS/TS utils; helper functions I've missed from standard libraries (and React)
Latest version: 0.8.1

# @rdub/base

JS/TS utils; helper functions I've missed from standard libraries (and React)

<a href="https://npmjs.org/package/@rdub/base" title="@rdub/base on NPM"><img src="https://img.shields.io/npm/v/@rdub/base.svg" alt="@rdub/base NPM version" /></a>

- [a.tsx] - Anchor component wrapper (sets `target="_blank"` and `rel="noreferrer"` for external URLs).
- [arr.ts] - Array utils: `Arr`, `concat`, `isSorted`, `range`, `scan`, seedable `shuffle`, `sum`
- [color-scheme.tsx] - `useColorScheme` React hook for managing light/dark mode
- [console.ts] - import-able `time`, `timeEnd`, `log`, `warn`, `error`
- [dom.tsx] - element-Props aliases, partially-apply `className`s
- [heading.tsx]: `<H1>`…`<H6>` components: headings with configurable link-target offsets
- [json/load.ts], [json/fetch.ts]: `fetchJson`, `loadJson{,Sync}`
- [math.ts] - exports most of `Math`, also implements `clamp` and `interp`
- [objs.ts] - typed helpers for mapping between objects and arrays, over keys/values/entries
- [singleton.ts] - dedupe arrays, verify exactly one unique element, return it
- [state.ts] - `State<T, "name">` helper (`{ name: T, setName: (t: T) => void }`), `StateArr<T>` (`[T, Dispatch<T>]`), and aliases (`NS<T, Name>`, `S<T>`, etc.)
- [str.ts] - `titlecase` helper
- [time.ts] - `time`, `timeEnd`, `Timer`
- [use-origin.ts] - `useOrigin` hook: get `window.location.origin`, with optional/typesafe default
- [use-set.ts] - `useSet`, `useOptSet` hooks for React

In Nextjs, add this package to `transpilePackages`:
```js
// next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
  transpilePackages: ['@rdub/icons'],
  // ...
}
```

Otherwise you might see runtime errors like:
```
 ⨯ Error: Cannot find module '$PWD/node_modules/.pnpm/@rdub+base@file+..+..+..+js+base+dist_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/@rdub/base/a' imported from $PWD/node_modules/.pnpm/@rdub+base@file+..+..+..+js+base+dist_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/@rdub/base/index.js
    at Error: Cannot find module '$PWD/node_modules/.pnpm/@rdub+base (file+..+..+..+js+base+dist_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/@rdub/base/a' imported from $PWD/node_modules/.pnpm/@rdub+base@file+..+..+..+js+base+dist_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/@rdub/base/index.js) {
  code: 'ERR_MODULE_NOT_FOUND',
  url: 'file://$PWD/node_modules/.pnpm/@rdub+base@file+..+..+..+js+base+dist_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/@rdub/base/a'
}
```

[a.tsx]: src/a.tsx
[arr.ts]: src/arr.ts
[color-scheme.tsx]: src/color-scheme.tsx
[console.ts]: src/console.ts
[dom.tsx]: src/dom.tsx
[heading.tsx]: src/heading.tsx
[json/load.ts]: src/json/load.ts
[json/fetch.ts]: src/json/fetch.ts
[math.ts]: src/math.ts
[objs.ts]: src/objs.ts
[singleton.ts]: src/singleton.ts
[state.ts]: src/state.ts
[str.ts]: src/str.ts
[time.ts]: src/time.ts
[use-origin.ts]: src/use-origin.ts
[use-set.ts]: src/use-set.ts