Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nethergamesmc/liblokilogger
Grafana Loki log exporter for PocketMine-MP
https://github.com/nethergamesmc/liblokilogger
Last synced: 24 days ago
JSON representation
Grafana Loki log exporter for PocketMine-MP
- Host: GitHub
- URL: https://github.com/nethergamesmc/liblokilogger
- Owner: NetherGamesMC
- License: lgpl-2.1
- Created: 2022-07-04T16:48:18.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-11-29T14:45:11.000Z (about 1 month ago)
- Last Synced: 2024-11-29T15:41:16.861Z (about 1 month ago)
- Language: PHP
- Size: 197 KB
- Stars: 7
- Watchers: 6
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# libLokiLogger
[Grafana Loki](https://grafana.com/oss/loki/) asynchronous logging utility for PocketMine-MP logger. It will log
everything from any threads you want.# Getting started
You will have to initialize and start `LokiLoggerThread` process in your plugin, you can supply your own composer autoloader path
if you are using php's composer.Here is the code to start using the project:
```php
# Start logging thread.
$lokiFactory = new LokiLoggerThread(COMPOSER_AUTOLOADER_PATH, 'http://localhost:1300', ['app' => 'lobby-1', 'region' => 'ap', 'server-id' => '1']);
$lokiFactory->start();$this->getServer()->getAsyncPool()->addWorkerStartHook(function (int $workerId) use ($lokiFactory): void {
$this->getServer()->getAsyncPool()->submitTaskToWorker(new LokiRegisterAsyncTask($lokiFactory), $workerId);
});# Add an attachment to the server's logger, this will log everything in console into grafana loki.
Server::getInstance()->getLogger()->addAttachment(new LokiLoggerAttachment());
```