@@ -83,6 +83,7 @@ these variables:
8383| ` LIBRUS_GATEWAY_PASSWORD ` | ` gateway_api_20 ` | Password for the Gateway API 2.0 login. |
8484| ` LIBRUS_CHILD ` | No | Optional default child id or login for ` api_v3 ` CLI commands. |
8585| ` LIBRUS_TIMEOUT_MS ` | No | Positive integer request timeout in milliseconds. |
86+ | ` LIBRUS_LOG_LEVEL ` | No | Optional CLI SDK log level: ` debug ` , ` info ` , ` warn ` , or ` error ` . |
8687
8788If no timeout is configured, portal and child-scoped SDK requests default to
8889` 30000 ` milliseconds. Invalid timeout values fail fast with
@@ -117,6 +118,7 @@ import {
117118 generateWiadomosciOpenApiDocument ,
118119 LibrusSdkError ,
119120 type LibrusApiBackend ,
121+ type Logger ,
120122} from " librus-sdk" ;
121123```
122124
@@ -127,6 +129,7 @@ import {
127129| ` GatewayApi20AuthClient ` | Lower-level Gateway API 2.0 login/password auth client for ` synergia.librus.pl/gateway/api/2.0 ` cookie-backed requests. |
128130| ` PortalClient ` | Lower-level portal session client for ` portal.librus.pl ` login, ` /Me ` , and ` /SynergiaAccounts ` . |
129131| ` SynergiaApiClient ` | Child-scoped GET client for the supported ` https://api.librus.pl/3.0 ` surface when you already have a bearer token. |
132+ | ` Logger ` | Minimal structured logging interface accepted by SDK clients and sessions. |
130133| ` generateOpenApiDocument ` | Generates the shipped OpenAPI document for the supported ` api_v3 ` child-scoped GET subset. |
131134| ` generateGatewayApi20OpenApiDocument ` | Generates the shipped OpenAPI document for the supported ` gateway_api_20 ` GET subset. |
132135| ` generateWiadomosciOpenApiDocument ` | Generates the shipped OpenAPI document for the supported ` wiadomosci.librus.pl/api ` inbox subset. |
@@ -143,6 +146,26 @@ const grades = await client.getGrades();
143146console .log (grades );
144147```
145148
149+ Custom logger:
150+
151+ ``` ts
152+ import { LibrusSession , type Logger } from " librus-sdk" ;
153+ import pino from " pino" ;
154+
155+ const pinoLogger = pino ();
156+ const logger: Logger = {
157+ log : (level , event , fields ) => pinoLogger [level ]({ event , ... fields }),
158+ };
159+
160+ const session = LibrusSession .fromEnv (process .env , { logger });
161+ const client = await session .forChild (" child-login" );
162+ await client .getGrades ();
163+ ```
164+
165+ SDK logs are structured and secret-safe. They include request URLs, status,
166+ durations, auth mode, and stable error codes, but never include passwords,
167+ bearer tokens, cookie values, request bodies, or response bodies.
168+
146169Gateway API 2.0 flow:
147170
148171``` bash
@@ -171,9 +194,9 @@ with `UNSUPPORTED_BACKEND` in `gateway_api_20`.
171194
172195Current high-level methods on ` LibrusSession ` :
173196
174- - ` LibrusSession.fromEnv(env?) `
197+ - ` LibrusSession.fromEnv(env?, options? ) `
175198- ` LibrusSession.fromGatewayCredentials(credentials, options?) `
176- - ` new LibrusSession({ apiBackend?, credentials, portalClient?, portalClientOptions?, gatewayApi20AuthClient?, gatewayApi20AuthClientOptions?, bffClientOptions?, synergiaClientOptions?, wiadomosciClientOptions?, requestTimeoutMs? }) `
199+ - ` new LibrusSession({ apiBackend?, credentials, portalClient?, portalClientOptions?, gatewayApi20AuthClient?, gatewayApi20AuthClientOptions?, bffClientOptions?, synergiaClientOptions?, wiadomosciClientOptions?, requestTimeoutMs?, logger? }) `
177200- ` login() `
178201- ` getApiBackend() `
179202- ` getPortalMe() `
@@ -311,6 +334,7 @@ Root CLI commands:
311334
312335- ` librus-sdk --help `
313336- ` librus-sdk --version `
337+ - ` librus-sdk --verbose <command> `
314338
315339Every leaf command supports ` --format <text|json> ` . In ` api_v3 ` , child-scoped
316340commands require a child selector: pass ` --child <id-or-login> ` or set
@@ -320,6 +344,10 @@ explicit `--child` fails with `UNSUPPORTED_BACKEND`. Portal-only commands such
320344as ` children list ` , ` messages bff-list ` , and ` messages wiadomosci-list ` are not
321345available in ` gateway_api_20 ` .
322346
347+ ` --verbose ` enables debug-level SDK diagnostics on stderr. ` LIBRUS_LOG_LEVEL `
348+ can enable diagnostics without a flag and filters by minimum level. Successful
349+ command payloads still go to stdout, so ` --format json ` remains machine-readable.
350+
323351| Family | Subcommands | Extra selectors and flags |
324352| ---------------- | ----------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
325353| ` children ` | ` list ` | Portal-only; no child selector. |
0 commit comments