Skip to content

Code cleanup for admin#769

Merged
poppastring merged 8 commits into
mainfrom
fixing-site-logging
Jan 20, 2026
Merged

Code cleanup for admin#769
poppastring merged 8 commits into
mainfrom
fixing-site-logging

Conversation

@poppastring
Copy link
Copy Markdown
Owner

PR Classification

Code cleanup and admin interface refactor to improve route consistency, logging, and maintainability.

PR Summary

This pull request standardizes admin routes, enhances activity log handling, and streamlines logging and configuration for better maintainability and usability.

  • Controllers and tag helpers: Refactored all admin actions to use consistent /admin/... routes for posts, authors, and activity logs.
  • ActivityRepo.cs and ActivityController.cs: Improved log file handling to support multiple patterns and filter by date, and simplified activity log navigation.
  • EventDataItem.cs: Updated log message formatting for safer and clearer parameter insertion.
  • Removed LoggingAgent middleware and related startup configuration.
  • appsettings.json: Set default logging level to "Error" and ensured absolute log directory paths.

Refactored logging across controllers to remove debug/timing logs and focus on meaningful events. Updated log levels in appsettings to "Error" for most sources and "Information" for DasBlog. Improved log messages for login failures, post edits/deletes, and site settings updates. Removed redundant and noisy log statements to ensure only significant events are logged.
- Updated EventDataItem to use placeholders for event code and URL, and ensure Params are stringified and non-null.
- Enhanced AccountController logout logging to include username.
- Removed LoggingAgent middleware and its registration from Startup.
- Suppressed Microsoft.AspNetCore.Watch logs in appsettings files.
Refactored all admin-related controller actions to use consistent /admin/ route prefixes (e.g., /admin/post/, /admin/authors/, /admin/activity/). Updated TagHelpers, layout links, and views to match the new route structure. This improves route clarity, separates admin and public actions, and simplifies future maintenance.
Replaced ASP.NET tag helper links for "Author" and "Activity" in the admin dropdown menu with direct href URLs to improve navigation consistency.
Index now redirects to EditAuthor with email parameter.
UpdateAuthor action formatting improved; redirect unchanged.

Redirect to EditAuthor with email param in AuthorController

Index now redirects to EditAuthor using the user's email.
UpdateAuthor action formatting improved; redirect unchanged.
Switched ViewBag configuration in EditAuthor to use UsersEditMode for proper context. Removed redundant EditAuthor action that only returned the view, simplifying the controller logic.
Standardize activity log URLs from /admin/activity to /admin/log across controllers and views. Removed redundant EventsByQuery action and updated navigation and date links for consistency.
- Support multiple log file patterns (including rolled files) for better compatibility with rolling log setups.
- Filter log entries to only include lines matching the requested date.
- Open log files with FileShare.ReadWrite for concurrent access.
- Use local date (DateTime.Today) as default in activity log view.
- Ensure log directory path is always absolute.
- Update activity log date selection form to use correct route and improve layout.
@poppastring poppastring merged commit c14d9d6 into main Jan 20, 2026
3 checks passed
@poppastring poppastring deleted the fixing-site-logging branch January 20, 2026 01:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant