@elysiumjs/hermes 0.1.1

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/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # @elysiumjs/hermes
2
+
3
+ Logging utilities for Elysium.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ bun add @elysiumjs/hermes
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```ts
14
+ import { LoggerService } from '@elysiumjs/hermes';
15
+
16
+ const logger = LoggerService.make('my-logger');
17
+
18
+ logger.info('Hello world!');
19
+ logger.error('Something went wrong!');
20
+ ```
21
+
22
+ ## License
23
+
24
+ This project is licensed under the Apache License, Version 2.0. See the [LICENSE](../../LICENSE) file for more info.
package/index.ts ADDED
@@ -0,0 +1,17 @@
1
+ // Copyright (c) 2025-present Workbud Technologies Inc. All rights reserved.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ import './src/services/pino.factory';
16
+
17
+ export { LoggerService } from './src/services/logger.service.ts';
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@elysiumjs/hermes",
3
+ "version": "0.1.1",
4
+ "module": "index.ts",
5
+ "type": "module",
6
+ "devDependencies": {
7
+ "@ianvs/prettier-plugin-sort-imports": "^4.4.1",
8
+ "@types/bun": "latest",
9
+ "type-fest": "^4.41.0"
10
+ },
11
+ "peerDependencies": {
12
+ "@elysiumjs/core": "latest",
13
+ "typescript": "^5.8.3"
14
+ },
15
+ "dependencies": {
16
+ "pino": "^9.6.0"
17
+ }
18
+ }
@@ -0,0 +1,63 @@
1
+ // Copyright (c) 2025-present Workbud Technologies Inc. All rights reserved.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ import type { Logger } from 'pino';
16
+
17
+ import { Service, ServiceScope } from '@elysiumjs/core';
18
+ import pino from 'pino';
19
+
20
+ @Service.register({ scope: ServiceScope.SINGLETON })
21
+ export class LoggerService {
22
+ readonly #pino: Logger;
23
+
24
+ public constructor(@Service.inject('elysium.hermes.pino') pino: pino.Logger) {
25
+ this.#pino = pino;
26
+ }
27
+
28
+ public static make(name: string) {
29
+ return new LoggerService(pino({ name }));
30
+ }
31
+
32
+ public info(message: string, details?: Record<string, unknown>) {
33
+ if (details) {
34
+ this.#pino.info(details, message);
35
+ } else {
36
+ this.#pino.info(message);
37
+ }
38
+ }
39
+
40
+ public error(message: string, details?: Record<string, unknown>) {
41
+ if (details) {
42
+ this.#pino.error(details, message);
43
+ } else {
44
+ this.#pino.error(message);
45
+ }
46
+ }
47
+
48
+ public warn(message: string, details?: Record<string, unknown>) {
49
+ if (details) {
50
+ this.#pino.error(details, message);
51
+ } else {
52
+ this.#pino.warn(message);
53
+ }
54
+ }
55
+
56
+ public debug(message: string, details?: Record<string, unknown>) {
57
+ if (details) {
58
+ this.#pino.error(details, message);
59
+ } else {
60
+ this.#pino.debug(message);
61
+ }
62
+ }
63
+ }
@@ -0,0 +1,20 @@
1
+ // Copyright (c) 2025-present Workbud Technologies Inc. All rights reserved.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ import { Service } from '@elysiumjs/core';
16
+ import pino from 'pino';
17
+
18
+ const pinoFactory = () => pino();
19
+
20
+ Service.factory('elysium.hermes.pino', pinoFactory);