[PR #1367] [MERGED] Add Source to Logging #3526

Closed
opened 2026-04-25 00:16:00 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/1367
Author: @lkiesow
Created: 1/5/2023
Status: Merged
Merged: 1/5/2023
Merged by: @advplyr

Base: masterHead: log-source


📝 Commits (2)

  • 10fd514 Add Source to Logging
  • 3426832 Fix for windows, update regex to only include line number, move to end of log

📊 Changes

2 files changed (+17 additions, -6 deletions)

View changed files

📝 server/Logger.js (+16 -6)
📝 server/Server.js (+1 -0)

📄 Description

The Audiobookshelf logs sometimes contain information about the source of the log statement, but sometimes they don't This really depends on developers adding these information to the log messages.

But even then, the information is usually just a hint about the module logging this, like [Db] or [Watcher]`, and finding the exact line can be hard.

This patch automatically adds the source of the log statement to the logs. This means if someone calls Logger.info(…) in line 22 of foo.js, the log statement will contain this file and line:

[2023-01-05 19:04:12[ (LogManager.js:85:18) DEBUG: Daily Log file found 2023-01-05.txt
[2023-01-05 19:04:12] (LogManager.js:59:12)  INFO: [LogManager] Init current daily log filename: 2023-01-05.txt

This should make it much easier to identify the code where the log statement originated from.

Long-term, this also means that we can probably remove the manually set identifiers contained in the log messages, like the [LogManager] in the example above.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf/pull/1367 **Author:** [@lkiesow](https://github.com/lkiesow) **Created:** 1/5/2023 **Status:** ✅ Merged **Merged:** 1/5/2023 **Merged by:** [@advplyr](https://github.com/advplyr) **Base:** `master` ← **Head:** `log-source` --- ### 📝 Commits (2) - [`10fd514`](https://github.com/advplyr/audiobookshelf/commit/10fd51498c5214d9a73b2cc1cc8c8d66ac9a78ce) Add Source to Logging - [`3426832`](https://github.com/advplyr/audiobookshelf/commit/3426832f2ba57b0886fdd543642b6201d36ec004) Fix for windows, update regex to only include line number, move to end of log ### 📊 Changes **2 files changed** (+17 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `server/Logger.js` (+16 -6) 📝 `server/Server.js` (+1 -0) </details> ### 📄 Description The Audiobookshelf logs sometimes contain information about the source of the log statement, but sometimes they don't This really depends on developers adding these information to the log messages. But even then, the information is usually just a hint about the module logging this, like `[Db]` or [Watcher]`, and finding the exact line can be hard. This patch automatically adds the source of the log statement to the logs. This means if someone calls `Logger.info(…)` in line `22` of `foo.js`, the log statement will contain this file and line: ``` [2023-01-05 19:04:12[ (LogManager.js:85:18) DEBUG: Daily Log file found 2023-01-05.txt [2023-01-05 19:04:12] (LogManager.js:59:12) INFO: [LogManager] Init current daily log filename: 2023-01-05.txt ``` This should make it much easier to identify the code where the log statement originated from. Long-term, this also means that we can probably remove the manually set identifiers contained in the log messages, like the `[LogManager]` in the example above. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:16:00 +02:00
adam closed this issue 2026-04-25 00:16:00 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#3526