Skip to content

Commit 0beae9f

Browse files
committed
Added system.host.${string} to allower namespaces
1 parent b64d2e0 commit 0beae9f

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ A full example is the Sentry plugin: https://github.com/ioBroker/plugin-sentry o
146146
Placeholder for the next version (at the beginning of the line):
147147
### **WORK IN PROGRESS**
148148
-->
149+
### **WORK IN PROGRESS**
150+
- (@GermanBluefox) Added `system.host.${string}` to allower namespaces
151+
149152
### 3.0.1 (2025-10-08)
150153

151154
- (@GermanBluefox) The code was rewritten to TypeScript

src/lib/NamespaceLogger.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@
22
* Logger with Namespace-prefix for ioBroker
33
*/
44
export default class NamespaceLogger {
5-
readonly #namespaceLog: string;
5+
readonly #namespaceLog: `${`system.adapter.${string}.${number}` | `system.host.${string}`} Plugin ${string}`;
66
#logger: ioBroker.Logger;
77

88
/**
99
* @param namespaceLog Logging-Namespace as prefix
1010
* @param logger Logger-instance
1111
*/
12-
constructor(namespaceLog: string, logger: ioBroker.Logger) {
12+
constructor(
13+
namespaceLog: `${`system.adapter.${string}.${number}` | `system.host.${string}`} Plugin ${string}`,
14+
logger: ioBroker.Logger,
15+
) {
1316
this.#namespaceLog = namespaceLog;
1417
// We need to bind this context, otherwise this can be undefined
1518
// when logger methods are passed around.

src/types.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ export interface PluginHandlerSettings {
3131
/** The scope in which the plugin will be executed */
3232
scope: 'adapter' | 'controller';
3333
/** The object namespace for the plugin, e.g. `system.adapter.<adaptername>.0.plugins.name`, or `system.host.<hostname>.plugins.name` */
34-
namespace: `system.adapter.${string}.${number}`;
34+
namespace: `system.adapter.${string}.${number}` | `system.host.${string}`;
3535
/** The namespace which will be used for logging */
36-
logNamespace: string;
36+
logNamespace: `${`system.adapter.${string}.${number}` | `system.host.${string}`} Plugin ${string}`;
3737
/** The logger object to use for logging */
3838
log: ioBroker.Logger;
3939
/** The complete ioBroker configuration object */
@@ -48,11 +48,11 @@ export interface PluginSettings {
4848
/** The scope in which the plugin will be executed */
4949
pluginScope: 'adapter' | 'controller';
5050
/** The object namespace for the parent of the plugin, e.g. `system.adapter.<adaptername>.0`, or `system.host.<hostname>.` */
51-
parentNamespace: `system.adapter.${string}.${number}`;
51+
parentNamespace: `system.adapter.${string}.${number}` | `system.host.${string}`;
5252
/** The object namespace for the plugin, e.g. `system.adapter.<adaptername>.0.plugins.name`, or `system.host.<hostname>.plugins.name` */
53-
pluginNamespace: `system.adapter.${string}.${number}.plugins.${string}`;
53+
pluginNamespace: `system.adapter.${string}.${number}.plugins.${string}` | `system.host.${string}.plugins.${string}`;
5454
/** The namespace which will be used for logging */
55-
pluginLogNamespace: string;
55+
pluginLogNamespace: `${`system.adapter.${string}.${number}` | `system.host.${string}`} Plugin ${string}`;
5656
/** The logger object to use for logging */
5757
log: ioBroker.Logger;
5858
/** The complete ioBroker configuration object */

0 commit comments

Comments
 (0)