mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
feat(logging): implement core logging library with structured logging service
- Added Core Logging library providing centralized logging functionality. - Implemented LoggingService with multiple log levels and configurable sinks. - Created ConsoleLogSink for logging to the browser console. - Introduced LoggerApi for context-aware logging. - Added support for custom sinks and logging configuration during app initialization. - Enhanced FilterService and FilterMenuButtonComponent with logging capabilities. - Updated ESLint and Jest configurations for the new logging library. - Documented the logging library API and usage in README.
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import { computed, inject, Injectable, Input, signal } from '@angular/core';
|
||||
import { computed, inject, Injectable, signal } from '@angular/core';
|
||||
import { InputType } from '../types';
|
||||
import { getState, patchState, signalState } from '@ngrx/signals';
|
||||
import { mapToFilter } from './mappings';
|
||||
import { isEqual } from 'lodash';
|
||||
import { logger } from '@isa/core/logging';
|
||||
import {
|
||||
FilterInput,
|
||||
OrderByDirectionSchema,
|
||||
@@ -13,6 +14,8 @@ import { FILTER_ON_COMMIT, FILTER_ON_INIT, QUERY_SETTINGS } from './tokens';
|
||||
|
||||
@Injectable()
|
||||
export class FilterService {
|
||||
#logger = logger();
|
||||
|
||||
#onInit = inject(FILTER_ON_INIT, { optional: true })?.map((fn) => fn(this));
|
||||
#onCommit = inject(FILTER_ON_COMMIT, { optional: true })?.map((fn) =>
|
||||
fn(this),
|
||||
@@ -33,7 +36,9 @@ export class FilterService {
|
||||
orderBy = this.#state.orderBy;
|
||||
|
||||
constructor() {
|
||||
this.#logger.info('FilterService initialized with default state:');
|
||||
this.#onInit?.forEach((initFn) => {
|
||||
this.#logger.info('Executing init function:', initFn);
|
||||
initFn();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import { NgIconComponent, provideIcons } from '@ng-icons/core';
|
||||
import { FilterMenuComponent } from './filter-menu.component';
|
||||
import { isaActionFilter } from '@isa/icons';
|
||||
import { FilterService } from '../../core';
|
||||
import { logger, provideLoggerContext } from '@isa/core/logging';
|
||||
|
||||
/**
|
||||
* A button component that toggles the visibility of a filter menu.
|
||||
@@ -23,10 +24,20 @@ import { FilterService } from '../../core';
|
||||
templateUrl: './filter-menu-button.component.html',
|
||||
styleUrls: ['./filter-menu-button.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
imports: [IconButtonComponent, OverlayModule, NgIconComponent, FilterMenuComponent],
|
||||
providers: [provideIcons({ isaActionFilter })],
|
||||
imports: [
|
||||
IconButtonComponent,
|
||||
OverlayModule,
|
||||
NgIconComponent,
|
||||
FilterMenuComponent,
|
||||
],
|
||||
providers: [
|
||||
provideIcons({ isaActionFilter }),
|
||||
provideLoggerContext({ component: FilterMenuButtonComponent }),
|
||||
],
|
||||
})
|
||||
export class FilterMenuButtonComponent {
|
||||
#logger = logger();
|
||||
|
||||
scrollStrategy = inject(Overlay).scrollStrategies.block();
|
||||
|
||||
#filter = inject(FilterService);
|
||||
@@ -68,6 +79,7 @@ export class FilterMenuButtonComponent {
|
||||
* Emits `opened` or `closed` events based on the new state.
|
||||
*/
|
||||
toggle() {
|
||||
this.#logger.debug('toggle', this.open());
|
||||
const open = this.open();
|
||||
this.open.set(!open);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user