More logging
This commit is contained in:
		
							parent
							
								
									168d659785
								
							
						
					
					
						commit
						8c7be4a443
					
				@ -30,7 +30,7 @@ export default class Socket implements WebSocketConnection {
 | 
				
			|||||||
        this.socket.addEventListener('open', handler);
 | 
					        this.socket.addEventListener('open', handler);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    onClose(handler: () => void): void {
 | 
					    onClose(handler: (e: CloseEvent) => void): void {
 | 
				
			||||||
        this.socket.addEventListener('close', handler);
 | 
					        this.socket.addEventListener('close', handler);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -296,10 +296,12 @@ function showPatchNotes(): void {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function onReady(): void {
 | 
					function onReady(): void {
 | 
				
			||||||
    log.transports.file.level = 'debug';
 | 
					    const logLevel = (process.env.NODE_ENV === 'production') ? 'info' : 'silly';
 | 
				
			||||||
    log.transports.console.level = 'debug';
 | 
					
 | 
				
			||||||
 | 
					    log.transports.file.level = logLevel;
 | 
				
			||||||
 | 
					    log.transports.console.level = logLevel;
 | 
				
			||||||
    log.transports.file.maxSize = 5 * 1024 * 1024;
 | 
					    log.transports.file.maxSize = 5 * 1024 * 1024;
 | 
				
			||||||
    log.transports.file.file = path.join(baseDir, 'log.txt');
 | 
					
 | 
				
			||||||
    log.info('Starting application.');
 | 
					    log.info('Starting application.');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    app.setAppUserModelId('com.squirrel.fchat.F-Chat');
 | 
					    app.setAppUserModelId('com.squirrel.fchat.F-Chat');
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,16 @@
 | 
				
			|||||||
import * as qs from 'querystring';
 | 
					import * as qs from 'querystring';
 | 
				
			||||||
 | 
					import log from 'electron-log'; //tslint:disable-line:match-default-export-name
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import {GeneralSettings} from './common';
 | 
					import {GeneralSettings} from './common';
 | 
				
			||||||
import Window from './Window.vue';
 | 
					import Window from './Window.vue';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const logLevel = (process.env.NODE_ENV === 'production') ? 'info' : 'silly';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					log.transports.file.level = logLevel;
 | 
				
			||||||
 | 
					log.transports.console.level = logLevel;
 | 
				
			||||||
 | 
					log.transports.file.maxSize = 5 * 1024 * 1024;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const params = <{[key: string]: string | undefined}>qs.parse(window.location.search.substr(1));
 | 
					const params = <{[key: string]: string | undefined}>qs.parse(window.location.search.substr(1));
 | 
				
			||||||
const settings = <GeneralSettings>JSON.parse(params['settings']!);
 | 
					const settings = <GeneralSettings>JSON.parse(params['settings']!);
 | 
				
			||||||
//tslint:disable-next-line:no-unused-expression
 | 
					//tslint:disable-next-line:no-unused-expression
 | 
				
			||||||
 | 
				
			|||||||
@ -94,7 +94,14 @@ export default class Connection implements Interfaces.Connection {
 | 
				
			|||||||
            const data = msg.length > 6 ? <object>JSON.parse(msg.substr(4)) : undefined;
 | 
					            const data = msg.length > 6 ? <object>JSON.parse(msg.substr(4)) : undefined;
 | 
				
			||||||
            return this.handleMessage(type, data);
 | 
					            return this.handleMessage(type, data);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        this.socket.onClose(async() => {
 | 
					        this.socket.onClose(async(event: CloseEvent) => {
 | 
				
			||||||
 | 
					            log.debug(
 | 
				
			||||||
 | 
					                'socket.onclose',
 | 
				
			||||||
 | 
					              {
 | 
				
			||||||
 | 
					                event
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
 | 
					            );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if(this.pinTimeout) clearTimeout(this.pinTimeout);
 | 
					            if(this.pinTimeout) clearTimeout(this.pinTimeout);
 | 
				
			||||||
            if(!this.cleanClose) this.reconnect();
 | 
					            if(!this.cleanClose) this.reconnect();
 | 
				
			||||||
            this.socket = undefined;
 | 
					            this.socket = undefined;
 | 
				
			||||||
 | 
				
			|||||||
@ -245,7 +245,7 @@ export interface WebSocketConnection {
 | 
				
			|||||||
    close(): void
 | 
					    close(): void
 | 
				
			||||||
    onMessage(handler: (message: string) => Promise<void>): void
 | 
					    onMessage(handler: (message: string) => Promise<void>): void
 | 
				
			||||||
    onOpen(handler: () => void): void
 | 
					    onOpen(handler: () => void): void
 | 
				
			||||||
    onClose(handler: () => void): void
 | 
					    onClose(handler: (e: CloseEvent) => void): void
 | 
				
			||||||
    onError(handler: (error: Error) => void): void
 | 
					    onError(handler: (error: Error) => void): void
 | 
				
			||||||
    send(message: string): void
 | 
					    send(message: string): void
 | 
				
			||||||
    readyState: WebSocketConnection.ReadyState
 | 
					    readyState: WebSocketConnection.ReadyState
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user