@@ -3,6 +3,7 @@ import { Meta } from '@angular/platform-browser';
33import { environment } from '../environments/environment' ;
44import { AppService } from './service/app.service' ;
55import { LayoutService } from './service/layout.service' ;
6+ import { log } from './model/log' ;
67import type { LoadLayout , MahFormat } from './model/types' ;
78import { GameComponent } from './components/game/game-component.component' ;
89
@@ -35,7 +36,7 @@ export class AppComponent implements OnInit {
3536 ngOnInit ( ) : void {
3637 this . init ( )
3738 . catch ( error => {
38- console . error ( error ) ;
39+ log . error ( error ) ;
3940 } ) ;
4041 }
4142
@@ -65,7 +66,7 @@ export class AppComponent implements OnInit {
6566 this . editorLoading = false ;
6667 } )
6768 . catch ( error => {
68- console . error ( error ) ;
69+ log . error ( error ) ;
6970 this . editorLoading = false ;
7071 } ) ;
7172 }
@@ -109,7 +110,7 @@ export class AppComponent implements OnInit {
109110 try {
110111 window . history . replaceState ( null , '' , window . location . pathname ) ;
111112 } catch ( error ) {
112- console . error ( error ) ;
113+ log . error ( error ) ;
113114 }
114115 }
115116
@@ -122,31 +123,31 @@ export class AppComponent implements OnInit {
122123 try {
123124 decoded = atob ( base64jsonString ) ;
124125 } catch ( error ) {
125- console . warn ( 'Import failed: Invalid base64 encoding' , error ) ;
126+ log . warn ( 'Import failed: Invalid base64 encoding' , error ) ;
126127 return [ ] ;
127128 }
128129
129130 let parsed : unknown ;
130131 try {
131132 parsed = JSON . parse ( decoded ) ;
132133 } catch ( error ) {
133- console . warn ( 'Import failed: Invalid JSON format' , error ) ;
134+ log . warn ( 'Import failed: Invalid JSON format' , error ) ;
134135 return [ ] ;
135136 }
136137
137138 const mah = parsed as MahFormat ;
138139 if ( ! mah . mah || mah . mah !== '1.0' ) {
139- console . warn ( 'Import failed: Invalid or unsupported MAH format version' ) ;
140+ log . warn ( 'Import failed: Invalid or unsupported MAH format version' ) ;
140141 return [ ] ;
141142 }
142143
143144 if ( ! Array . isArray ( mah . boards ) ) {
144- console . warn ( 'Import failed: Missing or invalid boards array' ) ;
145+ log . warn ( 'Import failed: Missing or invalid boards array' ) ;
145146 return [ ] ;
146147 }
147148
148149 if ( mah . boards . length === 0 ) {
149- console . warn ( 'Import failed: No boards found in import data' ) ;
150+ log . warn ( 'Import failed: No boards found in import data' ) ;
150151 return [ ] ;
151152 }
152153
@@ -163,7 +164,7 @@ export class AppComponent implements OnInit {
163164 imported . push ( LayoutService . layout2loadLayout ( layout , custom . map ) ) ;
164165 }
165166 } catch ( error ) {
166- console . warn ( 'Failed to import individual board:' , error ) ;
167+ log . warn ( 'Failed to import individual board:' , error ) ;
167168 }
168169 }
169170
@@ -172,12 +173,12 @@ export class AppComponent implements OnInit {
172173 }
173174
174175 if ( result . length === 0 ) {
175- console . warn ( 'Import completed but no valid boards were imported' ) ;
176+ log . warn ( 'Import completed but no valid boards were imported' ) ;
176177 }
177178
178179 return result ;
179180 } catch ( error ) {
180- console . error ( 'Unexpected error during import:' , error ) ;
181+ log . error ( 'Unexpected error during import:' , error ) ;
181182 return [ ] ;
182183 }
183184 }
0 commit comments