https://github.com/graphile/postgraphile-log-consola
Use consola for PostGraphile logging
https://github.com/graphile/postgraphile-log-consola
Last synced: 6 months ago
JSON representation
Use consola for PostGraphile logging
- Host: GitHub
- URL: https://github.com/graphile/postgraphile-log-consola
- Owner: graphile
- License: mit
- Created: 2019-02-23T17:00:33.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-23T17:50:58.000Z (almost 7 years ago)
- Last Synced: 2025-04-10T23:43:33.667Z (9 months ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 7
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# postgraphile-log-consola
This [PostGraphile server
plugin](https://www.graphile.org/postgraphile/plugins/) disables
PostGraphile's query log and instead uses `consola` for logging.
## Installation
```
yarn add postgraphile-log-consola
```
## Usage - library
Use `makePluginHook` to load the plugin; see [the PostGraphile server plugins docs](https://www.graphile.org/postgraphile/plugins/) for more details.
```js
const { postgraphile, makePluginHook } = require("postgraphile");
const PostgraphileLogConsola = require("postgraphile-log-consola");
// Other server frameworks work similarly
const express = require("express");
const app = express();
const pluginHook = makePluginHook([PostgraphileLogConsola]); // 👈
app.use(
postgraphile(process.env.DATABASE_URL, "public", {
pluginHook, // 👈
// ...
})
);
app.listen(process.env.PORT || 3000);
```
## Usage - CLI
NOTE: `--plugins` must always be **the very first** option you use on the CLI.
Also note that this plugin only affects the query log, so the other messages the CLI generates are not wrapped.
```
postgraphile --plugins postgraphile-log-consola -c my_db
```