Skip to content

Commit

Permalink
feat: loki reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
Niki2k1 committed Mar 8, 2024
1 parent c8e1321 commit b1a84df
Show file tree
Hide file tree
Showing 8 changed files with 5,200 additions and 26 deletions.
35 changes: 19 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
# packageName
# consola-loki

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]

<!-- [![bundle][bundle-src]][bundle-href] -->
<!-- [![Codecov][codecov-src]][codecov-href] -->

This is my package description.
A Loki Reporter for Consola

## Usage

Install package:

```sh
# npm
npm install packageName
npm install consola-loki

# yarn
yarn add packageName
yarn add consola-loki

# pnpm
pnpm install packageName
pnpm install consola-loki

# bun
bun install packageName
bun install consola-loki
```

Import:

```js
// ESM
import {} from "packageName";
import { LokiReporter } from "consola-loki";

// CommonJS
const {} = require("packageName");
const { LokiReporter } = require("consola-loki");
```

## Development
Expand All @@ -44,6 +44,9 @@ const {} = require("packageName");
- Install dependencies using `pnpm install`
- Run interactive tests using `pnpm dev`

## Special Thanks
Hugely inspired by [winston-loki](https://github.com/JaniAnttonen/winston-loki)

## License

Made with 💛
Expand All @@ -52,13 +55,13 @@ Published under [MIT License](./LICENSE).

<!-- Badges -->

[npm-version-src]: https://img.shields.io/npm/v/packageName?style=flat&colorA=18181B&colorB=F0DB4F
[npm-version-href]: https://npmjs.com/package/packageName
[npm-downloads-src]: https://img.shields.io/npm/dm/packageName?style=flat&colorA=18181B&colorB=F0DB4F
[npm-downloads-href]: https://npmjs.com/package/packageName
[npm-version-src]: https://img.shields.io/npm/v/consola-loki?style=flat&colorA=18181B&colorB=F0DB4F
[npm-version-href]: https://npmjs.com/package/consola-loki
[npm-downloads-src]: https://img.shields.io/npm/dm/consola-loki?style=flat&colorA=18181B&colorB=F0DB4F
[npm-downloads-href]: https://npmjs.com/package/consola-loki

<!-- [codecov-src]: https://img.shields.io/codecov/c/gh/unjs/packageName/main?style=flat&colorA=18181B&colorB=F0DB4F
[codecov-href]: https://codecov.io/gh/unjs/packageName
<!-- [codecov-src]: https://img.shields.io/codecov/c/gh/unjs/consola-loki/main?style=flat&colorA=18181B&colorB=F0DB4F
[codecov-href]: https://codecov.io/gh/unjs/consola-loki
[bundle-src]: https://img.shields.io/bundlephobia/minzip/packageName?style=flat&colorA=18181B&colorB=F0DB4F
[bundle-href]: https://bundlephobia.com/result?p=packageName -->
[bundle-src]: https://img.shields.io/bundlephobia/minzip/consola-loki?style=flat&colorA=18181B&colorB=F0DB4F
[bundle-href]: https://bundlephobia.com/result?p=consola-loki -->
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "packageName",
"name": "consola-loki",
"version": "0.0.0",
"description": "",
"repository": "unjs/packageName",
"repository": "unjs/consola-loki",
"license": "MIT",
"sideEffects": false,
"type": "module",
Expand Down Expand Up @@ -37,10 +37,15 @@
"eslint": "^8.56.0",
"eslint-config-unjs": "^0.2.1",
"jiti": "^1.21.0",
"msw": "^2.2.3",
"prettier": "^3.2.5",
"typescript": "^5.3.3",
"unbuild": "^2.0.0",
"vitest": "^1.3.0"
},
"packageManager": "pnpm@8.12.1"
"packageManager": "pnpm@8.12.1",
"dependencies": {
"consola": "^3.2.3",
"ofetch": "^1.3.3"
}
}
23 changes: 21 additions & 2 deletions playground/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
import { test } from "../src";
import { hostname } from "node:os";
import { createConsola } from "consola";
import { LokiReporter } from "../src";

console.log(test());
const consola = createConsola({
reporters: [
new LokiReporter({
baseUrl: "your base url here",
user: "123456",
token: "glc_......",
labels: {
hostname: hostname(),
},
}),
],
});

consola.log("Test Log");
consola.info("Test Info");
consola.success("Test Success");
consola.warn("Test Warn");
consola.error("Test Error");
Loading

0 comments on commit b1a84df

Please sign in to comment.