Commit Graph

41 Commits

Author SHA1 Message Date
jdb 9e8ee446d1 Version 2.5.0 -- breaking change to BufferLogAppender's public constract.
Validate / test (push) Successful in 20s
BufferLogAppender now accepts threshold and optional size bounds via its
constructor, replaces bufferMax with the size target/max API, defaults
to bounded buffering, and may reassign its buffer during trim/clear
operations.

Also adds batched buffer trimming for high-throughput logging, a clamp
utility for bounds normalization, and expanded tests for buffer sizing,
trimming behavior, and clamp semantics.
2.5.0
2026-05-07 07:37:00 -05:00
jdb bf96303bf9 Update tests for BufferLogAppender and its utilities.
AI-Assisted: yes
AI-Tool: OpenAI Codex / gpt-5.5 xhigh
2026-05-07 07:37:00 -05:00
jdb 1546973475 Rework BufferLogAppender buffer sizing logic to be more performant in the face of heavy throughput. 2026-05-07 07:37:00 -05:00
jdb 5e167b7fb4 Include test in ESLint coverage. 2026-05-07 07:37:00 -05:00
mahseiah_ai ebcd7880fb feat: add buffer max to buffer appender 2026-05-07 07:37:00 -05:00
Mahseiah 70233cc941 docs: Add Development, CI, and Maintenance sections to README (fixes #7) 2026-05-07 07:37:00 -05:00
mahseiah_ai 66568b5e0f ci: switch to bun runner, remove setup-bun steps 2026-05-07 07:37:00 -05:00
mahseiah_ai ff0f797d20 ci: replace oven-sh/setup-bun with curl install for Gitea Actions compatibility
The  action is a GitHub Marketplace action
that doesn't exist on self-hosted Gitea instances. Replace it with
the standard curl-based Bun installation method and add ~/.bun/bin
to GITHUB_PATH.
2026-05-07 07:37:00 -05:00
mahseiah_ai 9ebac95c27 test: add comprehensive unit tests for all appenders and logger
Tests added:
- log-service.test.ts: hierarchical logger creation and threshold propagation
- logger.test.ts: threshold inheritance, message propagation, falsy threshold
  bug coverage (LogLevel.ALL = 0), deferred messages, Error handling
- log-message.test.ts: parseLogLevel parsing, flattenMessage object/string modes
- console-log-appender.test.ts: threshold, formatter, all-level routing
- buffer-log-appender.test.ts: buffer append, threshold filtering, clearBuffer
- api-log-appender.test.ts: configuration defaults, threshold, auth token

Also fixes src/index.ts to export BufferLogAppender which was previously
missing from the barrel export.
2026-05-07 07:37:00 -05:00
mahseiah_ai 7bb80989c4 ci: add Gitea Actions workflow for test validation
- Runs on PRs targeting main and pushes to main
- Uses oven-sh/setup-bun@v2 to provision Bun
- Runs bun test v1.3.12 (700fc117) to validate the library
2026-05-07 07:37:00 -05:00
mahseiah_ai a6aff1a5b9 build: add test and test:coverage scripts to package.json
- bun test v1.3.12 (700fc117) runs bun test (discovers tests in test/ directory)
- bun test v1.3.12 (700fc117) runs tests with coverage reporting
2026-05-07 07:37:00 -05:00
mahseiah_ai c957150879 test: stand up test scaffolding with bun test
- Create test/ directory with a minimal LogService test
- Prove out the pattern: bun test natively discovers and runs tests
  in the test/ directory using ESM-style imports from ../src/
2026-05-07 07:37:00 -05:00
jdb f405c0bc5a bump version for v2.4.0. 2.4.0 2026-05-05 08:54:00 -05:00
jdb f9cb676b46 Properly set default thresholds on log appenders. 2026-05-05 07:50:47 -05:00
jdb 4dcc4fad25 Add BufferLogAppender
Sometimes it is useful to capture log messages in a way that is easy for
the running program to introspect or manually handle.
*BufferLogAppender* captures the logs in a simple array.

Be careful, there is no default flush/clear mechanism that runs
automatically. Users of BufferLogAppender should take care to
render/handle log messages and periodically call `clearBuffer` on the
*BufferLogAppender* instance to avoid the buffer array growing without
limit.
2026-05-05 06:25:09 -05:00
jdb 895a8c42ca ConsoleLogAppender logs TRACE messages with console.log
console.trace generates and prints a full stacktrace for every log
message. This is not what TRACE means in this library. The TRACE level
is intended for logs that are more verbose than you typically want to
log and should only be turned on when you are trying to trace the
detailed behavior of the logged functionality. Printing the full stack
trace with every message makes an already verbose setting exponentially
worse.
2.3.3
2026-01-09 19:23:38 -06:00
jdb 642078e728 Fix all sources to comply with eslint rules introduced in 2.0.0 (no logic changes). 2026-01-09 19:19:15 -06:00
jdb 8b0acc6f40 Add fixed tool versions. 2026-01-09 19:18:56 -06:00
jdb eb89d1da71 Tweak: don't overshadow msg in inner context. 2.3.2 2026-01-09 18:46:30 -06:00
jdb 79b9fe20ac Correct ConsoleLogAppender to use msg instead of message. 2.3.1 2025-12-16 13:20:36 -06:00
jdb 47fa404914 Make ERROR and FATAL levels use the console.error function when logging to a JS console. 2.3.0 2025-12-15 12:26:49 -06:00
jdb 4ddeeab228 Clarify documentation for flattenMessage. 2025-12-15 12:26:09 -06:00
jdb f33ca24b53 timestamp -> ts; error -> err 2.2.0 2025-07-14 15:38:40 -05:00
jdb 318135e82b Update README based on naming convention change. 2025-06-26 10:58:27 -05:00
jdb ef2b0ed750 Change the naming convention for LogMessage internal message field. 2.1.0 2025-06-26 10:44:57 -05:00
jdb f21cce9944 Update eslint config. 2.0.0 2025-01-07 09:40:09 -06:00
jdb a89a41520c ConsoleLogAppender writes a human-readable summary when logging structured data.
Taking advantage of the new LogMessageFormatter return type, the
ConsoleLogAppender logs the formatted message as-is if it is a string,
but when processing structured data inserts a string summary consisting
of the message level, scope, and message summary or method. The full
object is still logged to the console as well for inspection.
2025-01-07 09:30:21 -06:00
jdb 6b4173d636 .gitignore for built packages created with npm pack 2025-01-07 08:53:25 -06:00
jdb 756ebf3c78 Allow LogMessageFormatter to return FlattenedLogMessages.
Originally the idea was that a log formatter should turn the LogMessage
into a string that can be appended via a LogAppender. However, all of
the default LogAppenders can handle objects. In particular, the
ConsoleLogAppender writes to the browser console which offers an
interactive UI experience when logging raw objects.

For LogAppenders that can only manage text, it seems an acceptable
design decision to require users to provide a LogMessageFormatter that
returns a string, or accept some sane default like JSON.stringify if
their formatter returns objects.
2025-01-07 08:48:37 -06:00
jdb 13941840ce Move back to npm (bun does not package correctly). 2025-01-02 22:53:10 -06:00
jdb c3e2152afb Refactor to default to structured logging.
- Added `flattenMessage` and `FlattenedLogMessage` to default to
  structured logging.
- Rework the logic formatting messages for the ConsoleLogger.
- Add a more comprehensive README.
2025-01-02 22:50:10 -06:00
jdb 4a9f582ad8 Migrate to bun and eslint. 2025-01-02 17:01:39 -06:00
jdb 8418b242c3 Replace Axios with fetch API. 1.1.5 2023-05-29 19:20:12 -05:00
jdb f0944d0d7e Update Axios for security fixes. 1.1.4 2023-05-29 19:03:55 -05:00
jdb f75edbc22a Fix NPM packaging. 1.1.3 2021-08-16 23:03:57 -05:00
jdb b2d1b71a52 Remove erroneously committed test code. 1.1.2 2021-07-23 00:15:32 -05:00
jdb c8ed8b61da Bump version to republish with built artifacts. 1.1.1 2021-07-23 00:12:23 -05:00
jdb 6562948acb Add convenience method for parsing LogLevel values form string. 1.1.0 2021-07-23 00:00:41 -05:00
jdb e42549773d Rename package to avoid conflict with existing modules. 1.0.0 2020-08-07 09:19:03 -05:00
jdb 73e8b0726c Fix package.json module definition. 2020-08-07 09:07:16 -05:00
jdb 1a96000e81 Initial 1.0.0 commit (library extracted from existing project). 2020-08-07 08:54:06 -05:00