Skip to content

Warner

Warning collector for BrikLab modules with Protection Levels.

Diagram

100%Ctrl + wheel to zoom

Constructor

ts
new Warner(options?: WarnerOptions)

Properties

PropertyTypeDescription
warningsWarning[]Collected warnings.

Methods

.setLevel(level: WarningLevel)

Sets the warning output level.

ArgumentTypeDescription
levelWarningLevelOutput level.

.setProtectionLevel(level: ProtectionLevel)

Sets the protection level.

ArgumentTypeDescription
levelProtectionLevelValidation strictness.

.getProtectionLevel()

Returns the current ProtectionLevel.

.setPackageName(name: string)

Sets the package name used in warning metadata.

ArgumentTypeDescription
namestringPackage name to attach to warnings.

.clear()

Clears all collected warnings.

.count()

Returns the number of collected warnings.

.warn(warning: Warning)

Adds a warning and optionally emits it immediately.

ArgumentTypeDescription
warningWarningWarning payload.

.finalize()

Finalizes warnings and logs a summary if configured.

.flush()

Alias for finalize().

References

Example

ts
const warner = new Warner({ level: "summary", protectionLevel: "boundary", packageName: "MyPackage" });
warner.warn({ message: "This is a warning", code: "WARN001", metadata: { detail: "Additional info" } });
warner.finalize();