Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/oderwat/nu_plugin_logfmt
A simple from / to logfmt plugin for nushell
https://github.com/oderwat/nu_plugin_logfmt
Last synced: 19 days ago
JSON representation
A simple from / to logfmt plugin for nushell
- Host: GitHub
- URL: https://github.com/oderwat/nu_plugin_logfmt
- Owner: oderwat
- License: mit
- Created: 2024-12-04T23:00:41.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2024-12-05T15:48:11.000Z (about 1 month ago)
- Last Synced: 2024-12-24T00:47:49.427Z (26 days ago)
- Language: Go
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-nu - nu_plugin_logfmt
README
# Nu Plugin Logfmt
## Overview
The `nu-plugin-logfmt` is a Nushell plugin that allows conversion between logfmt (a key=value format used by some logging systems) and Nushell
values. The plugin provides two commands:1. **from logfmt**: Converts a logfmt string to a Nushell record.
2. **to logfmt**: Converts a Nushell record to a logfmt string.### Steps to Install
Ensure you have Go installed on your system. You can download it from [here](https://golang.org/dl/).
```bash
go install github.com/oderwat/nu_plugin_logfmt@latest
plugin add ~/go/bin/nu_plugin_logfmt
plugin use nu_plugin_logfmt
```or move it to your nushell plugins directory if you have one for that.
## Usage
### from logfmt Command
The `from logfmt` command converts a logfmt string to a Nushell record.
If the `--typed` flag is given. The function detect simple types.
**Syntax:**
```nu
| from logfmt [--typed]
```**Example:**
```nu
'msg="Test message" level=info esc="» Say \"Hello\""' | from logfmt
```**Output:**
```nu
{
"level": "info",
"msg": "Test message",
"esc": "» Say \"Hello\""
}
```### to logfmt Command
The `to logfmt` command converts a Nushell record to a logfmt string.
**Syntax:**
```nu
| to logfmt
```**Example:**
```nu
{ "msg": "Hello World!", "Lang": { "Go": true, "Rust": false } } | to logfmt
```**Output:**
```nu
msg="Hello World!" Lang.Go=true Lang.Rust=false
```## License
Distributed under the MIT License. See `LICENSE` for more information.