You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-`NodeManagementModule` is back in the default module list — `addNodes()` / `deleteNodes()` / `addReferences()` / `deleteReferences()` reachable through `Opcua::*`. Servers without the service set raise `ServiceUnsupportedException` on first call (still a subclass of `ServiceException`, existing handlers keep matching).
20
+
- Top-level `ServiceFault` now decodes to `ServiceException` instead of the misleading `EncodingException: Buffer underflow`.
21
+
- Wire-format compliance fixes: `RequestHeader.timestamp` is a valid `UtcTime`, anonymous `policyId` discovered for all security modes, NodeManagement TypeIds reference DefaultBinary encoding, ECC sequence numbers per OPC UA 1.05.4. Servers stricter than UA-.NETStandard (open62541 etc.) are now reachable.
22
+
-**Cache codec breaking change** — persistent caches must be flushed on upgrade. `unserialize()` removed from every cache code path; `WireCacheCodec` (JSON gated by allowlist) is the new default. Pre-v4.3 entries are silently discarded on first access. New `ClientBuilder::setCacheCodec()` is available if you need to override.
23
+
- Daemon: `--version` flag, `umask(0077)` around bind closes the socket-permission race, NDJSON 64 KiB per-frame cap, IPv4-mapped IPv6 loopback handled, `username` no longer leaked via `list`, Windows path / URL redaction in error messages, conservative PID-check fallback.
24
+
- Daemon: Unix-socket path length is now validated before bind — long paths get a clear `DaemonException` instead of a confusing `chmod(): No such file or directory` after silent kernel truncation.
An explicit logger in the config takes precedence over the default Laravel logger.
31
31
32
+
### Per-Connection Log Channel (v4.3+)
33
+
34
+
Each entry in `config/opcua.php → connections` accepts a `log_channel` key naming a Laravel log channel. The package resolves it lazily at connection time, so the config file stays free of `Log::channel(...)` Facade calls (which would explode if the config is loaded before the framework is fully booted):
35
+
36
+
```php
37
+
'connections' => [
38
+
'default' => [
39
+
'endpoint' => 'opc.tcp://localhost:4840',
40
+
'log_channel' => 'stderr', // resolved via Laravel's log manager on demand
41
+
],
42
+
],
43
+
```
44
+
45
+
Or via env:
46
+
47
+
```dotenv
48
+
OPCUA_DEFAULT_LOG_CHANNEL=stderr
49
+
```
50
+
51
+
When omitted (or when the channel cannot be resolved), the manager falls back to the container-injected default logger.
52
+
53
+
### Logger Resolution Priority
54
+
55
+
When a connection is created, the manager picks a logger from the first source that yields one:
56
+
57
+
1.**Runtime override** — set via `OpcuaManager::setLogger()` / `useConsoleLogger()` (see below)
58
+
2.**Config `logger`** — a `LoggerInterface` instance in the connection config
59
+
3.**Config `log_channel`** — a Laravel channel name in the connection config
60
+
4.**Default logger** — the one auto-injected by the service provider
61
+
62
+
### Runtime Override (v4.3+)
63
+
64
+
`OpcuaManager` exposes `setLogger()` / `getLogger()` / `useConsoleLogger()` to swap the logger after the manager has been built. The override applies to every future connection and is best-effort propagated to existing connections that expose `setLogger()`:
$logger = Opcua::getLogger(); // retrieve the current override (or null)
71
+
```
72
+
73
+
The most common reason to reach for this is an Artisan command that wants OPC UA logs streamed to its `OutputInterface`, respecting `-v` / `-vv` / `-vvv`:
74
+
75
+
```php
76
+
use Illuminate\Console\Command;
77
+
78
+
class SyncOpcuaTags extends Command
79
+
{
80
+
protected $signature = 'opcua:sync-tags';
81
+
82
+
public function handle(): int
83
+
{
84
+
// Route client logs to the console, with millisecond timestamps.
85
+
Opcua::useConsoleLogger($this->output);
86
+
87
+
$client = Opcua::connect();
88
+
// ...
89
+
90
+
return self::SUCCESS;
91
+
}
92
+
}
93
+
```
94
+
95
+
`useConsoleLogger()` wraps Symfony's `ConsoleLogger` (so `error`/`warning` are always shown, `notice` needs `-v`, `info``-vv`, `debug``-vvv`) and prepends `[YYYY-MM-DD HH:MM:SS.mmm]` to every line by default. Pass `dateFormat: null` to disable the prefix, or any DateTime format string to customize it:
96
+
97
+
```php
98
+
Opcua::useConsoleLogger($this->output, dateFormat: null); // bare ConsoleLogger
`PhpOpcua\LaravelOpcua\Logging\TimestampedLogger` is a generic PSR-3 decorator that prepends a formatted timestamp before forwarding to any inner logger. It is what `useConsoleLogger()` uses internally, but you can apply it to any logger you already have:
105
+
106
+
```php
107
+
use PhpOpcua\LaravelOpcua\Logging\TimestampedLogger;
108
+
109
+
$decorated = new TimestampedLogger($someLogger, 'Y-m-d H:i:s.v');
* @param ?\Closure(string): ?LoggerInterface $loggerResolver Resolves a log channel name to a logger instance. Used to honour the per-connection 'log_channel' config key without needing a Facade in config files.
0 commit comments