logixlysia 3.6.2 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.7.0](https://github.com/PunGrumpy/logixlysia/compare/v3.6.2...v3.7.0) (2024-09-26)
4
+
5
+
6
+ ### Features
7
+
8
+ * **optional:** add startup message config ([c7a76db](https://github.com/PunGrumpy/logixlysia/commit/c7a76dbc0f30f4c9c607b52dedc49979e26b67ec))
9
+
3
10
  ## [3.6.2](https://github.com/PunGrumpy/logixlysia/compare/v3.6.1...v3.6.2) (2024-09-18)
4
11
 
5
12
 
package/README.md CHANGED
@@ -21,7 +21,8 @@ const app = new Elysia({
21
21
  }).use(
22
22
  logixlysia({
23
23
  config: {
24
- showBanner: true,
24
+ showStartupMessage: true,
25
+ startupMessageFormat: 'simple',
25
26
  ip: true,
26
27
  logFilePath: './logs/example.log',
27
28
  customLogFormat:
@@ -45,13 +46,14 @@ app.listen(3000)
45
46
 
46
47
  ### Options
47
48
 
48
- | Option | Type | Description | Default |
49
- | ------------------ | --------- | --------------------------------------------------------------------- | ------------------------------------------------------------------------- |
50
- | `showBanner` | `boolean` | Display the banner on the console | `true` |
51
- | `ip` | `boolean` | Display the incoming IP address based on the `X-Forwarded-For` header | `false` |
52
- | `customLogMessage` | `string` | Custom log message to display | `🦊 {now} {level} {duration} {method} {pathname} {status} {message} {ip}` |
53
- | `logFilter` | `object` | Filter the logs based on the level, method, and status | `null` |
54
- | `logFilePath` | `string` | Path to the log file | `./logs/elysia.log` |
49
+ | Option | Type | Description | Default |
50
+ | ---------------------- | ------------------------ | --------------------------------------------------------------------- | ------------------------------------------------------------------------- |
51
+ | `showStartupMessage` | `boolean` | Display the startup message | `true` |
52
+ | `startupMessageFormat` | `"banner"` \| `"simple"` | Choose the startup message format | `"banner"` |
53
+ | `ip` | `boolean` | Display the incoming IP address based on the `X-Forwarded-For` header | `false` |
54
+ | `customLogMessage` | `string` | Custom log message to display | `🦊 {now} {level} {duration} {method} {pathname} {status} {message} {ip}` |
55
+ | `logFilter` | `object` | Filter the logs based on the level, method, and status | `null` |
56
+ | `logFilePath` | `string` | Path to the log file | `./logs/elysia.log` |
55
57
 
56
58
  ### Custom Log Message
57
59
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "logixlysia",
3
- "version": "3.6.2",
3
+ "version": "3.7.0",
4
4
  "description": "🦊 Logixlysia is a logger for Elysia",
5
5
  "type": "module",
6
6
  "module": "src/index.ts",
@@ -71,24 +71,21 @@
71
71
  ],
72
72
  "dependencies": {
73
73
  "chalk": "^5.3.0",
74
- "elysia": "^1.1.4"
74
+ "elysia": "^1.1.16"
75
75
  },
76
76
  "devDependencies": {
77
- "@elysiajs/eden": "^1.1.1",
78
- "@eslint/js": "^9.8.0",
79
- "@trunkio/launcher": "^1.3.1",
80
- "@typescript-eslint/eslint-plugin": "^8.0.1",
81
- "@typescript-eslint/parser": "^8.0.1",
82
- "bun-types": "^1.1.20",
83
- "commitizen": "^4.3.0",
84
- "cz-conventional-changelog": "^3.3.0",
85
- "eslint": "9.x",
77
+ "@elysiajs/eden": "^1.1.3",
78
+ "@eslint/js": "^9.11.1",
79
+ "@trunkio/launcher": "^1.3.2",
80
+ "@typescript-eslint/eslint-plugin": "^8.7.0",
81
+ "@typescript-eslint/parser": "^8.7.0",
82
+ "bun-types": "^1.1.29",
86
83
  "eslint-plugin-simple-import-sort": "^12.1.1",
87
84
  "globals": "^15.9.0",
88
- "husky": "^9.1.1",
89
- "lint-staged": "^15.2.7",
85
+ "husky": "^9.1.6",
86
+ "lint-staged": "^15.2.10",
90
87
  "prettier": "^3.3.3",
91
- "typescript-eslint": "^8.0.1"
88
+ "typescript-eslint": "^8.7.0"
92
89
  },
93
90
  "peerDependencies": {
94
91
  "typescript": "^5.2.2"
package/src/index.ts CHANGED
@@ -10,7 +10,10 @@ export default function logixlysia(options?: Options): Elysia {
10
10
  return new Elysia({
11
11
  name: 'Logixlysia'
12
12
  })
13
- .onStart(ctx => startServer(ctx.server as Server, options))
13
+ .onStart(ctx => {
14
+ const showStartupMessage = options?.config?.showStartupMessage ?? true
15
+ if (showStartupMessage) startServer(ctx.server as Server, options)}
16
+ )
14
17
  .onRequest(ctx => {
15
18
  ctx.store = { beforeTime: process.hrtime.bigint() }
16
19
  })
@@ -26,6 +29,6 @@ export default function logixlysia(options?: Options): Elysia {
26
29
  })
27
30
  }
28
31
 
29
- export { createLogger } from './core'
30
- export { handleHttpError } from './core'
32
+ export { createLogger, handleHttpError } from './core'
31
33
  export { logToTransports } from './transports'
34
+
@@ -8,7 +8,7 @@ const createBoxText = (text: string, width: number): string => {
8
8
 
9
9
  export default function startServer(config: Server, options?: Options): void {
10
10
  const { hostname, port, protocol } = config
11
- const showBanner = options?.config?.showBanner ?? true
11
+ const showBanner = options?.config?.startupMessageFormat !== 'simple'
12
12
 
13
13
  if (showBanner) {
14
14
  const ELYSIA_VERSION = import.meta.require('elysia/package.json').version
@@ -88,7 +88,8 @@ export interface Options {
88
88
  } | null
89
89
  ip?: boolean
90
90
  useColors?: boolean
91
- showBanner?: boolean
91
+ showStartupMessage?: boolean
92
+ startupMessageFormat?: 'banner' | 'simple'
92
93
  transports?: Transport[]
93
94
  }
94
95
  }