@@ -9,10 +9,8 @@ An advanced and customisable logging library for [ElysiaJS](https://elysiajs.com
99- [ Logestic] ( #logestic )
1010- [ Table of Contents] ( #table-of-contents )
1111- [ Installation] ( #installation )
12- - [ Configuration] ( #configuration )
1312- [ Usage] ( #usage )
14- - [ Preset logging] ( #preset-request-logging )
15- - [ Custom logging] ( #custom-request-logging )
13+ - [ Documentation] ( #documentation )
1614- [ Contributing Guidelines] ( #contributing-guidelines )
1715- [ License] ( #license )
1816
@@ -26,11 +24,7 @@ Add the package to your Elysia Project via [bun](https://bun.sh).
2624
2725## Usage
2826
29- There are two ways to add logging to your Elysia application.
30-
31- ### Preset request logging
32-
33- Currently, there are these [ presets] ( ./src/presets/index.ts ) available to use.
27+ There are two ways to add logging to your Elysia application. The quickest way to use this logger is using a preset.
3428
3529``` typescript
3630import { Elysia } from ' elysia' ;
@@ -45,55 +39,11 @@ const app = new Elysia()
4539 });
4640```
4741
48- ![ Custom Preset] ( ./screenshots/custom-preset.png )
49-
50- ### Custom request logging
51-
52- If you don't like any of presets, you can configure Logestic to log your requests in your way.
53-
54- 1 . Create a ` Logestic ` instance, optionally where you wish to log.
55- 2 . Call ` use ` to tell ` Logestic ` the information you wish to use.
56- 3 . Finally, create an ` Elysia ` instance on ` custom ` with the formatting function.
57-
58- ``` typescript
59- // ./logger.ts
60- import { Logestic , chalk } from ' logestic' ;
61-
62- // exports an Elysia instance
63- export default new Logestic ()
64- .use ([' method' , ' path' , ' time' , ' status' ])
65- .format ({
66- onSuccess({ method , path , time , status }) {
67- return ` [${time }]: ${method } ${path } | ${status } `
68- },
69- onFailure({ request , error , code , datetime }) {
70- return chalk .red (` ERROR [${datetime }]: ${request .method } ${request .url } | ${code } ` )
71- }
72- });
73-
74- // ./index.ts
75- import myLogger from ' ./logger' ;
76-
77- const app = new Elysia ()
78- .use (myLogger )
79- .get (' /' , () => " Hello from server" )
80- /* ... */
81- .listen (3000 , () => {
82- console .log (" Server is running on port 3000" )
83- });
84- ```
85-
86- Consider contributing your own preset; check [ contributing guidelines] ( #contributing-guidelines ) .
42+ These [ presets] ( https://github.com/cybercoder-naj/logestic/wiki/Presets ) available to use.
8743
88- ## Configuration
44+ ## Documentation
8945
90- | Name | Type | Description | Default |
91- | :--: | :--: | :-------- | :----- |
92- | dest | ` BunFile ` | The destination file for logging. | ` Bun.stdout ` |
93- | showLevel | ` boolean ` | Whether to show the log level. | ` false ` |
94- | logLevelColour | ` LogLevelColour ` | The colour of each log level. | ` { [key in LogType]: undefined } ` |
95- | httpLogging | ` boolean ` | Log successful http requests | ` true ` |
96- | explicitLogging | ` boolean ` | Allow logging for explicit calls | ` true ` |
46+ To view the full documentation, view the [ wiki] ( https://github.com/cybercoder-naj/logestic/wiki/ ) .
9747
9848## Contributing Guidelines
9949
0 commit comments