team_logger 0.6.0
team_logger: ^0.6.0 copied to clipboard
A logging library for big teams, big applications and huge logs.
0.6.0 #
- Per-value sanitization of logged data: assign [Loggable.sanitizer] to
process every value on its way to the output. The callback receives a
[SanitizeContext] (name, value, a lazily built path such as
user.card.number, depth) and returns the value unchanged, a replacement, or [Sanitize.drop] to remove the property/entry from the output entirely. The hook is global, so it cannot be forgotten on a publisher: it applies to the console printer, file storage, session export and any direct [Loggable.objectToString]/[objectToJson] call — including an in-app log viewer. - A replacement is rendered as a plain value: the original's children are
no longer offered to the rule, but the replacement's own children are,
normally — a rule whose replacement itself matches the same rule
recurses forever. A property's
viewis what the rule sees, not the text it renders (no [LoggableView] goes through the walkers), so such a property must be redacted byname/path, not by matching rendered content. In a collection-element position [Sanitize.drop] renders'<dropped>'rather than removing the element, so the printed collection length stays honest. - The rule must be free of side effects and must neither render nor log from inside itself — [Loggable.sanitizer] is a per-isolate static, so set it again in any isolate you spawn. Cycle protection, collection limits and lazy iterables are unaffected: sanitization happens while rendering, so filtered-out logs still cost nothing. The raw value still lives in [Log.data]; reach for [Logger.transformer] when a value must not exist in memory at all.
0.5.2 #
- Pre-publication log processing (primarily for security — masking
secrets/PII, dropping forbidden logs): require
logger_builder^0.5.0, whose new API flows through the re-export. Assign [Logger.transformer] (Log? Function(Log)) to process every log right before publishing — subloggers inherit it likelevel/publisher; returningnulldrops the log. Wrap a single publisher in [TransformPublisher] to transform for one destination only. Fail-closed: a throwing transformer drops the log and reports the error toonError/the current zone — the untransformed log is never published. - Add [Log.copyWith] — the building block for transformers: replaces
message/data/tags/error/stackTrace/path/traceIds while always preserving
the log's identity ([Log.num], [Log.time], the level and zone; no new
sequence number is consumed).
copyWith(error: null)clears the error,data: Log.noDataclears the data.
0.5.1 #
- Internal: [FileLogStorage] drops its pending-log counter and the
flush()fast path — workarounds for theflush()hang of logger_builder <= 0.3.2.flush()now awaits initialization and relies on the drain semantics of the base class; the guarantees are unchanged (initialization completed, everything published is on disk).
0.5.0 #
- [breaking changes] Require
logger_builder^0.4.0 (the changes flow through the re-export):HasFlushis renamed to [Flushable] (the old name remains as a deprecated alias), the new [Closable] interface exposesclose(), [MultiPublisher] gains a closed state and copies the publisher list at construction, [CustomLevelLogger] can no longer be implemented outside logger_builder, async publishers getonError,isClosedand non-hanging drain-semanticsflush(). See the logger_builder 0.3.3/0.4.0 changelog for the full list. - [FileLogStorage.onError] is now the inherited base-class callback: it additionally receives the write-pipeline errors of [AsyncPublisherWithBufferBase] (previously they were reported to the current zone).
0.4.2 #
- Require
logger_builder^0.3.2: an exception thrown by one publisher in [MultiPublisher] no longer interrupts publishing to the remaining publishers and no longer propagates to the logging call site. The new [MultiPublisher.onError] callback receives the failing publisher along with the error; without it, the error is reported to the current zone as an uncaught asynchronous error. [MultiPublisher.flush] now starts flushing all publishers even if one of them throws synchronously.
0.4.1 #
- [breaking changes] The
ansi_escape_codesre-export is narrowed toStyle,NoStyle,Color16,Color256: the full barrel leaked names clashing with Flutter (Color,Colors,Stack,State,Text). For the predefined style shortcuts (rgb431, ...) depend onansi_escape_codesdirectly (ideally with an import prefix).
0.4.0 #
- [breaking changes] Rename [Log.sequenceNum] to [Log.num] ([lastSequenceNum] to [lastNum]).
- [breaking changes] Rename [LogSequenceNum] to [LogNum].
- [breaking changes] Rename [LogThemeData.sequenceNumStyle] to [numStyle].
- [breaking changes] Rename [LogStorage.indexBySequenceNum] to [indexByNum].
- [breaking changes] Rename [collectionShowLength] to [collectionShowCount] (in [LoggableConfig] and [LogMainTheme]).
- [breaking changes] Rename [LoggableResolvedConfig] to [LoggableEffectiveConfig], [LoggableConfig.resolved] to [toEffectiveConfig].
- [breaking changes] The [TypeProp] constructor is now private.
- Export [LoggableJsonConfig]; add [Prop.toMapEntry] and [Prop.toJson].
- [breaking changes] [LoggableTypeConverter] is reduced to [convertToData]: the [toJson]/[toLogString] members were never called by the library.
- [LoggableMultiView.toJson] now returns a structured object
(
{":k": "multi-view", ":v": [...]}) instead of a joined string. - [breaking changes] Rename [Constraints] to [LogConstraints] (the old name clashed with the Flutter type).
- [breaking changes] [LogThemeData.copyWith] no longer accepts the phantom [colon]/[ellipsis]/[lineBreak]/[padding] parameters (they were silently ignored; the real fields live in [LogMainTheme]).
- [activeNamespaces] now matches child namespaces by prefix ('app' activates 'app/net' but not 'application'); [ConsoleLogPrinter.pathSeparator] is configurable.
- The printer's minLevel gate takes the minimum of the active and inactive themes, so active logs are never suppressed harder than background ones.
- Add [LogMainTheme.ansiCodesEnabled]; colorless theme copies no longer leak ANSI codes. Default themes no longer stamp a '#log' tag.
- Level [LogTheme]s are cached per [LogMainTheme] (BbCode regex is no longer recompiled for every message).
- Re-export the
ansi_escape_codesstyles, so themes can be configured without a direct dependency. - Fix a batch of review findings: cyclic structures no longer crash
formatting ([StackOverflowError]) — a cycle is rendered as
↺ₙ(N = levels up, configurable via [LogMainTheme.cycleFormatter]/[cycleStyle]) and as{":k": "cycle", ":up": N}in JSON; [BbCodeFormatter] no longer truncates messages; single-character messages are printed; a tail wider than [maxLength] no longer drops the log line; truncation/wrapping is surrogate-safe; fillers show no ellipsis; stack trace frames wrap instead of losing the file name; [LogStorage] edge cases (maxCount 0, publish after dispose, reversed.reversed, growable snapshot); tags accept any iterable; collection length budgets include the ellipsis; [ControlCodeFormatter] no longer leaks a bare ANSI reset; [LogTime] column width no longer jitters with microseconds; [LoggableView] (null) and duplicate props are consistent between string and JSON output; non-finite doubles (nan/inf) omit units in both outputs; user map keys starting with ':' are escaped; [LogTags] prints nothing when there are no tags. - [breaking changes] Rename [collectionMaxLength] to [collectionMaxCount].
- [Loggable.efficientLengthIterableToString] and [Loggable.iterableToString] now accept the parameter [collectionMaxCount] = 0.
- Add [Loggable.objectToJson].
- Add [LoggableData.round].
- Add file-based session log storage
(
package:team_logger/team_logger_io.dart): [FileLogStorage] writes logs to per-session JSON Lines files with chunk rotation ([maxSessionSize]/[maxChunkSize]), startup cleanup ([maxAge], [maxTotalSize]) and a metadata line; [FileLogSessions]/[FileLogSession] list, read, delete, export sessions and pack them into a single ZIP archive ([archiveTo]).
0.3.0 #
- Update README.
- [breaking changes] Rename [activeLoggers] to [activeNamespaces].
- [breaking changes] Rename [activeLevel] to [activeMinLevel].
- [breaking changes] Remove [AnsiPair].
- Add [activeLevels].
- Fix minor bugs.
0.2.0-0.2.2 #
- Publish.
0.1.0-0.1.70 #
- Initial version.