1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-01-20 16:50:28 -05:00
forgejo/modules/log
Earl Warren 9a608a034d feat: add a buffer writer to the logger, for internal use (#6551)
Identical to console, file or conn but writes to a buffer instead.

It is useful in two contexts:

- tests that need to assert the logs in a way that is simpler than
  LogChecker.
- capturing the logs of a given task to display in the web UI,
  return from the API, etc.

Since all logged events at a given level are written to the buffer by default, it is best used with WriterMode.Expression to only keep the log lines of interest.

## Checklist

The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org).

### Tests

- I added test coverage for Go changes...
  - [x] in their respective `*_test.go` for unit tests.
  - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I added test coverage for JavaScript changes...
  - [ ] in `web_src/js/*.test.js` if it can be unit tested.
  - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)).

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [x] I do not want this change to show in the release notes.
- [ ] I want the title to show in the release notes with a link to this pull request.
- [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6551
Reviewed-by: Antonin Delpeuch <wetneb@noreply.codeberg.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-01-13 13:40:24 +00:00
..
color.go Rewrite logger system (#24726) 2023-05-21 22:35:11 +00:00
color_console.go log: journald integration (#2869) 2024-08-09 07:49:13 +00:00
color_console_other.go [CHORE] Fix darwin compatibility 2024-08-09 17:44:41 +02:00
color_console_windows.go Rewrite logger system (#24726) 2023-05-21 22:35:11 +00:00
color_router.go Rewrite logger system (#24726) 2023-05-21 22:35:11 +00:00
event_format.go log: journald integration (#2869) 2024-08-09 07:49:13 +00:00
event_format_test.go log: journald integration (#2869) 2024-08-09 07:49:13 +00:00
event_writer.go Rewrite logger system (#24726) 2023-05-21 22:35:11 +00:00
event_writer_base.go Reduce some allocations in type conversion (#26772) 2023-08-29 00:43:16 +08:00
event_writer_buffer.go feat: add a buffer writer to the logger, for internal use (#6551) 2025-01-13 13:40:24 +00:00
event_writer_buffer_test.go feat: add a buffer writer to the logger, for internal use (#6551) 2025-01-13 13:40:24 +00:00
event_writer_conn.go Rewrite logger system (#24726) 2023-05-21 22:35:11 +00:00
event_writer_conn_test.go Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
event_writer_console.go Rewrite logger system (#24726) 2023-05-21 22:35:11 +00:00
event_writer_file.go Use stderr as fallback if the log file can't be opened (#26074) 2023-07-24 04:57:21 +00:00
flags.go log: journald integration (#2869) 2024-08-09 07:49:13 +00:00
flags_test.go Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
groutinelabel.go chore: Make Forgejo build with go1.24 2024-12-17 16:12:22 +01:00
groutinelabel_go1.24.go chore: Make Forgejo build with go1.24 2024-12-17 16:12:22 +01:00
groutinelabel_test.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
init.go Do not output "Trace" level logs from process manager by default (#24952) 2023-05-27 10:55:24 +00:00
level.go log: journald integration (#2869) 2024-08-09 07:49:13 +00:00
level_test.go Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
logger.go Rewrite logger system (#24726) 2023-05-21 22:35:11 +00:00
logger_global.go Fix sub-command log level (#25537) 2023-06-28 08:02:06 +02:00
logger_impl.go Fix sub-command log level (#25537) 2023-06-28 08:02:06 +02:00
logger_test.go Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
manager.go Do not output "Trace" level logs from process manager by default (#24952) 2023-05-27 10:55:24 +00:00
manager_test.go Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
misc.go Rewrite logger system (#24726) 2023-05-21 22:35:11 +00:00
stack.go Rewrite logger system (#24726) 2023-05-21 22:35:11 +00:00