tftsr-devops_investigation/node_modules/@wdio/logger/README.md
Shaun Arman 8839075805 feat: initial implementation of TFTSR IT Triage & RCA application
Implements Phases 1-8 of the TFTSR implementation plan.

Rust backend (Tauri 2.x, src-tauri/):
- Multi-provider AI: OpenAI-compatible, Anthropic, Gemini, Mistral, Ollama
- PII detection engine: 11 regex patterns with overlap resolution
- SQLCipher AES-256 encrypted database with 10 versioned migrations
- 28 Tauri IPC commands for triage, analysis, document, and system ops
- Ollama: hardware probe, model recommendations, pull/delete with events
- RCA and blameless post-mortem Markdown document generators
- PDF export via printpdf
- Audit log: SHA-256 hash of every external data send
- Integration stubs for Confluence, ServiceNow, Azure DevOps (v0.2)

Frontend (React 18 + TypeScript + Vite, src/):
- 9 pages: full triage workflow NewIssue→LogUpload→Triage→Resolution→RCA→Postmortem→History+Settings
- 7 components: ChatWindow, TriageProgress, PiiDiffViewer, DocEditor, HardwareReport, ModelSelector, UI primitives
- 3 Zustand stores: session, settings (persisted), history
- Type-safe tauriCommands.ts matching Rust backend types exactly
- 8 IT domain system prompts (Linux, Windows, Network, K8s, DB, Virt, HW, Obs)

DevOps:
- .woodpecker/test.yml: rustfmt, clippy, cargo test, tsc, vitest on every push
- .woodpecker/release.yml: linux/amd64 + linux/arm64 builds, Gogs release upload

Verified:
- cargo check: zero errors
- tsc --noEmit: zero errors
- vitest run: 13/13 unit tests passing

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 22:36:25 -05:00

121 lines
4.1 KiB
Markdown

WDIO Logger Utility
===================
> A helper utility for logging of WebdriverIO packages
This package is used across all WebdriverIO packages to log information using the [`loglevel`](https://www.npmjs.com/package/loglevel) package. It can also be used for any other arbitrary Node.js project.
## Install
To install the package just call
```sh
npm install @wdio/logger
```
or when adding it to a WebdriverIO subpackage:
```sh
lerna add @wdio/logger --scope <subpackage>
```
## Usage
The package exposes a logger function that you can use to register an instance for your scoped package:
```js
import logger from '@wdio/logger'
const log = logger('myPackage')
log.info('some logs')
```
For more info see [`loglevel`](https://www.npmjs.com/package/loglevel) package on NPM.
## Custom Log Levels
This package extends the log levels available in [`loglevel`](https://www.npmjs.com/package/loglevel) by introducing a new level called `progress`.
The `progress` level is particularly useful when you need to dynamically update a specific line in the terminal. For example, it can be utilized to display the download progress of browsers or drivers.
Notably, the `progress` level is equivalent to the `info` level. Therefore, if you set the log level to `error` or `silent`, any `progress` logs will be suppressed.
It's important to mention that `progress` writes directly to `process.stdout`, and these logs won't be captured in any log files.
To ensure consistent formatting with subsequent logs while using `progress`, it's essential to clear it at the end. To do so, simply call `progress` with an empty string, which will clear the last line:
```
log.progress('')
```
### Illustrative Usage of Progress
```javascript
import logger from '@wdio/logger';
const log = logger('internal');
const totalSize = 100;
let uploadedSize = 0;
const uploadInterval = setInterval(() => {
const chunkSize = 10;
uploadedSize += chunkSize;
const data = `Progress: ${(uploadedSize * 100) / totalSize}%`;
log.progress(data);
if (uploadedSize >= totalSize) {
clearInterval(uploadInterval);
log.progress(''); // Called at the end to maintain the alignment of subsequent logs.
console.log('Upload complete.');
}
}, 100);
```
## Masking Patterns
For more secure logging, `setMaskingPatterns`, `WDIO_LOG_MASKING_PATTERNS` or `maskingPatterns` can obfuscate sensitive information from the log.
For example, we can replace `--key=MySecretKey` with `--key=**MASKED**` to hide your cloud service access key or secret key
- The regular expression pattern must be provided as a string similar as a RegEx but as string type, for example, `--key=[^ ]*`
- It support flags and capturing groups like `/--key=([^ ]*)/i`
- Multiple patterns are separated by a comma, like `--key=([^ ]*),secrets=([^ ]*)`
- If no capturing group is provided, the entire matching string of the pattern is masked
- If one or more capturing groups are provided, we replace all the matching groups with `**MASKED**`
- If there are multiple matches for a single group, we replace them all, too
- Support both masking in a file and the console
- Note: In the console, when masking, some colors get stripped, which is a known limitation
`setMaskingPatterns` example
```javascript
import logger from '@wdio/logger';
// Default for all loggers
logger.setMaskingPatterns('/--key=([^ ]*)/i,/--secrets=([^ ]*)/i')
// For a specific logger
logger.setMaskingPatterns({'internal' : '/--key=([^ ]*)/i,/--secrets=([^ ]*)/i'})
const log = logger('internal');
```
Using wdio config from a `conf.ts` file, we can also configure masking patterns
```javascript
export const config: WebdriverIO.Config = {
/**
* test configurations
*/
logLevel: 'debug',
maskingPatterns: '/--key=([^ ]*)/i,/--secrets=([^ ]*)/i',
}
```
Below are examples with the environment variable `WDIO_LOG_MASKING_PATTERNS` in the code directly:
```javascript
// Using environment variable in code
process.env.WDIO_LOG_MASKING_PATTERNS = '/--key=([^ ]*)/i,/--secrets=([^ ]*)/i'
```
Or before your command line
```shell
WDIO_LOG_MASKING_PATTERNS='RESULT ([^ ]*)' npx wdio run ./wdio/wdio.conf.ts
```