Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/iam-medvedev/rich-log

React plugin for writing styled console logs using JSX.
https://github.com/iam-medvedev/rich-log

Last synced: about 1 month ago
JSON representation

React plugin for writing styled console logs using JSX.

Awesome Lists containing this project

README

        

# Rich Log

React plugin for writing styled console logs using JSX.

## Get started

```bash
yarn add rich-log
```

[Try it on CodeSandbox](https://codesandbox.io/s/silly-roman-3x7zcw?file=/src/App.tsx)

```tsx
import RichLog from 'rich-log';

RichLog.log(

This is

rich-log


v1.0.0

,
);
```

Output:

rich-log preview

Thats it!

## Benefits ✨

- JSX in `console.log`
- Styling with props (like styled-component)
- Lightweight
- Written in Typescript
- Works with React and Preact

## Components

### ``

A component for displaying styled text.

```tsx
RichLog.log(

Hello world
,
);
```

Output:

rich-log text component output

### ``

If you want to display several components at once, you can nest them in a fragment.

```tsx
RichLog.log(

My name is:
Slim Shady
,
);
```

Output:

rich-log fragment component output

If you want to separate text lines, you use the `separate`-prop:

```tsx
RichLog.log(

First line
Second line
,
);
```

Output:

rich-log separate text component output

### ``

Component for rendering data to table.

```tsx
RichLog.log();
```

Output:

rich-log table component output

### ``

Component for grouping logs.

```tsx
RichLog.log(

Collapsed group

}
>
I'am a text inside group
,
);
```

Output:

rich-log group component output

### ``

Component for rendering images and gifs.

```tsx
RichLog.log(



,
);
```

Output:

rich-log img component output

### ``

Component for rendering svg icons.

```tsx
RichLog.log(






,
);
```

Output:

rich-log svg component output

### ``

Component for rendering boxes.

```tsx
RichLog.log(




,
);
```

rich-log svg component output

## TODO

- [ ] Safari support
- [ ] Styled tables

## License

`rich-log` is [WTFPL licensed](./LICENSE).