diff --git a/src/app/pages/logs/logs.component.html b/src/app/pages/logs/logs.component.html index 4c86955..365b954 100644 --- a/src/app/pages/logs/logs.component.html +++ b/src/app/pages/logs/logs.component.html @@ -67,7 +67,667 @@
+ + + +
+
+

Set the daemon log categories

+
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ +
+ + +
+ + +
+ + +
+ + + +
+ + +
+ + + +
+ + +
+ + + +
+ + +
+ + + + +
+ + +
+ + + +
+ + +
+ + + + +
+ + +
+ + + +
+ + +
+ + + +
+ + +
+ + +
+ + +
+
+ + +
+

Daemon

+ +
+ +
+ + +
+ +
+ + +
+ +
+ +
+

Cn

+ +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+

Net

+ +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+

Blockchain

+ +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +
+

Wallet

+ +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + +
+ + +
+ +
+ + +
+ +
+ + + +
+

Debug Tools

+ +
+ +
+ + +
+ +
+ + +
+ +
+ +
+
+ +
+ + + +
diff --git a/src/app/pages/logs/logs.component.ts b/src/app/pages/logs/logs.component.ts index ae1eaf0..a81b4e3 100644 --- a/src/app/pages/logs/logs.component.ts +++ b/src/app/pages/logs/logs.component.ts @@ -3,6 +3,7 @@ import { LogsService } from './logs.service'; import { NavbarService } from '../../shared/components/navbar/navbar.service'; import { NavbarLink } from '../../shared/components/navbar/navbar.model'; import { DaemonService } from '../../core/services'; +import { LogCategories } from '../../../common'; @Component({ selector: 'app-logs', @@ -18,7 +19,12 @@ export class LogsComponent implements AfterViewInit { public setLogLevelError: string = ''; public setLogLevelSuccess: boolean = false; - public setLogCategoriesCategories: string = ''; + //public readonly setLogCategoriesCategories: LogCategories = new LogCategories(); + + public get setLogCategoriesCategories(): LogCategories { + return this.logsService.categories; + } + public settingLogCategories: boolean = false; public setLogCategoriesError: string = ''; public setLogCategoriesSuccess: boolean = false; @@ -107,4 +113,25 @@ export class LogsComponent implements AfterViewInit { this.settingLogHashRate = false; } + + public async setLogCategories(): Promise { + this.settingLogCategories = true; + + try + { + const categories = this.setLogCategoriesCategories.toString(); + + await this.daemonService.setLogCategories(categories); + + this.setLogCategoriesError = ``; + this.setLogCategoriesSuccess = true; + } + catch(error) { + this.setLogCategoriesError = `${error}`; + this.setLogCategoriesSuccess = false; + } + + this.settingLogCategories = false; + } } + diff --git a/src/app/pages/logs/logs.service.ts b/src/app/pages/logs/logs.service.ts index 25f61b0..a7cd008 100644 --- a/src/app/pages/logs/logs.service.ts +++ b/src/app/pages/logs/logs.service.ts @@ -1,6 +1,7 @@ import { EventEmitter, Injectable, NgZone } from '@angular/core'; import { ipcRenderer, webFrame } from 'electron'; import { ElectronService } from '../../core/services'; +import { LogCategories } from '../../../common'; @Injectable({ providedIn: 'root' @@ -8,6 +9,7 @@ import { ElectronService } from '../../core/services'; export class LogsService { public readonly onLog: EventEmitter = new EventEmitter(); public readonly lines: string[] = []; + public readonly categories: LogCategories = new LogCategories(); private readonly ansiRegex: RegExp = /\u001b\[[0-9;]*m/g; constructor(private electronService: ElectronService, private ngZone: NgZone) { diff --git a/src/common/LogCategories.ts b/src/common/LogCategories.ts new file mode 100644 index 0000000..46171ec --- /dev/null +++ b/src/common/LogCategories.ts @@ -0,0 +1,248 @@ +export type LogCategoryLevel = '' | 'TRACE' | 'DEBUG' | 'INFO' | 'WARNING' | 'ERROR' | 'FATAL'; + +export class LogCategories { + all: LogCategoryLevel = 'WARNING'; + default: LogCategoryLevel = ''; + + net: LogCategoryLevel = 'FATAL'; + netHttp: LogCategoryLevel = ''; + netP2p: LogCategoryLevel = 'FATAL'; + netThrottle: LogCategoryLevel = '' + netDns: LogCategoryLevel = ''; + netDl: LogCategoryLevel = ''; + netCn: LogCategoryLevel = 'FATAL'; + + blockchain: LogCategoryLevel = ''; + blockchainDb: LogCategoryLevel = ''; + blockchainDbLmdb: LogCategoryLevel = ''; + + bcutil: LogCategoryLevel = ''; + checkpoints: LogCategoryLevel = ''; + + i18n: LogCategoryLevel = ''; + perf: LogCategoryLevel = ''; + stacktrace: LogCategoryLevel = 'INFO'; + updates: LogCategoryLevel = ''; + account: LogCategoryLevel = ''; + + cn: LogCategoryLevel = ''; + cnBlockQueue: LogCategoryLevel = ''; + + difficulty: LogCategoryLevel = ''; + hardfork: LogCategoryLevel = ''; + miner: LogCategoryLevel = ''; + txpool: LogCategoryLevel = ''; + + daemon: LogCategoryLevel = ''; + daemonRpc: LogCategoryLevel = ''; + + debugToolsDeserialize: LogCategoryLevel = ''; + debugToolsObjectSizes: LogCategoryLevel = ''; + + deviceLedger: LogCategoryLevel = ''; + + walletGenMultisig: LogCategoryLevel = ''; + walletSimpleWallet: LogCategoryLevel = ''; + walletAPI: LogCategoryLevel = ''; + walletRingDb: LogCategoryLevel = ''; + walletWallet2: LogCategoryLevel = ''; + walletRpc: LogCategoryLevel = ''; + + testsCore: LogCategoryLevel = ''; + + multisig: LogCategoryLevel = ''; + bulletproofs: LogCategoryLevel = ''; + ringct: LogCategoryLevel = ''; + + logging: LogCategoryLevel = 'INFO'; + global: LogCategoryLevel = 'INFO'; + verify: LogCategoryLevel = 'FATAL'; + + msgwriter: LogCategoryLevel = 'INFO'; + + public toString(): string { + const values: string[] = []; + + if (this.all != '') { + values.push(`*:${this.all}`); + } + + if (this.default != '') { + values.push(`default:${this.default}`); + } + + if (this.net != '') { + values.push(`net:${this.net}`); + } + + if (this.netHttp != '') { + values.push(`net.http:${this.netHttp}`); + } + + if (this.netP2p != '') { + values.push(`net.p2p:${this.netP2p}`); + } + + if (this.netThrottle != '') { + values.push(`net.throttle:${this.netThrottle}`); + } + + if (this.netDns != '') { + values.push(`net.dns:${this.netDns}`); + } + + if (this.netDl != '') { + values.push(`net.dl:${this.netDl}`); + } + + if (this.netCn != '') { + values.push(`net.cn:${this.netCn}`); + } + + if (this.blockchain != '') { + values.push(`blockchain:${this.blockchain}`); + } + + if (this.blockchainDb != '') { + values.push(`blockchain.db:${this.blockchainDb}`); + } + + if (this.blockchainDbLmdb != '') { + values.push(`blockchain.db.lmdb:${this.blockchainDbLmdb}`); + } + + if (this.bcutil != '') { + values.push(`bcutil:${this.bcutil}`); + } + + if (this.checkpoints != '') { + values.push(`checkpoints:${this.checkpoints}`); + } + + if (this.i18n != '') { + values.push(`i18n:${this.i18n}`); + } + + if (this.perf != '') { + values.push(`perf:${this.perf}`); + } + + if (this.stacktrace != '') { + values.push(`stacktrace:${this.stacktrace}`); + } + + if (this.updates != '') { + values.push(`updates:${this.updates}`); + } + + if (this.account != '') { + values.push(`account:${this.account}`); + } + + if (this.cn != '') { + values.push(`cn:${this.cn}`); + } + + if (this.cnBlockQueue != '') { + values.push(`cn.block_queue:${this.cnBlockQueue}`); + } + + if (this.difficulty != '') { + values.push(`difficulty:${this.difficulty}`); + } + + if (this.hardfork != '') { + values.push(`hardfork:${this.hardfork}`); + } + + if (this.miner != '') { + values.push(`miner:${this.miner}`); + } + + if (this.txpool != '') { + values.push(`txpool:${this.txpool}`); + } + + if (this.daemon != '') { + values.push(`daemon:${this.daemon}`); + } + + if (this.daemonRpc != '') { + values.push(`daemon.rpc:${this.daemonRpc}`); + } + + if (this.debugToolsDeserialize != '') { + values.push(`debugtools.deserialize:${this.debugToolsDeserialize}`); + } + + if (this.debugToolsObjectSizes != '') { + values.push(`debugtools.objectsizes:${this.debugToolsObjectSizes}`); + } + + if (this.deviceLedger != '') { + values.push(`device.ledger:${this.deviceLedger}`); + } + + if (this.walletGenMultisig != '') { + values.push(`wallet.gen_multisig:${this.walletGenMultisig}`); + } + + if (this.walletSimpleWallet != '') { + values.push(`wallet.simplewallet:${this.walletSimpleWallet}`); + } + + if (this.walletAPI != '') { + values.push(`WalletAPI:${this.walletAPI}`); + } + + if (this.walletRingDb != '') { + values.push(`wallet.ringdb:${this.walletRingDb}`); + } + + if (this.walletWallet2 != '') { + values.push(`wallet.wallet2:${this.walletWallet2}`); + } + + if (this.walletRpc != '') { + values.push(`wallet.rpc:${this.walletRpc}`); + } + + if (this.testsCore != '') { + values.push(`tests.core:${this.testsCore}`); + } + + if (this.multisig != '') { + values.push(`multisig:${this.multisig}`); + } + + if (this.bulletproofs != '') { + values.push(`bulletproofs:${this.bulletproofs}`); + } + + if (this.ringct != '') { + values.push(`ringct:${this.ringct}`); + } + + if (this.logging != '') { + values.push(`logging:${this.logging}`); + } + + if (this.global != '') { + values.push(`global:${this.global}`); + } + + if (this.verify != '') { + values.push(`verify:${this.verify}`); + } + + if (this.msgwriter != '') { + values.push(`msgwriter:${this.msgwriter}`); + } + + return values.join(','); + } + + public equals(categories: LogCategories): boolean { + return this.toString() == categories.toString(); + } +} diff --git a/src/common/index.ts b/src/common/index.ts index 89162c1..7ba8cfc 100644 --- a/src/common/index.ts +++ b/src/common/index.ts @@ -32,6 +32,7 @@ export { SyncInfo } from './SyncInfo'; export { TxBacklogEntry } from './TxBacklogEntry'; export { TxInfo } from './TxInfo'; export { UpdateInfo } from './UpdateInfo'; +export { LogCategoryLevel, LogCategories } from './LogCategories'; export * from './error'; export * from './request';