Skip to content
Snippets Groups Projects
Commit c30fcd64 authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[enh] refactoring: logs on document receiving

parent 268aba57
No related branches found
No related tags found
No related merge requests found
import {CommonConstants} from "../../../lib/common-libs/constants" import {CommonConstants} from "../../../lib/common-libs/constants"
import * as stream from "stream" import * as stream from "stream"
import {hashf} from "../../../lib/common" import {hashf} from "../../../lib/common"
import {NewLogger} from "../../logger"
const logger = NewLogger()
export abstract class GenericParser extends stream.Transform { export abstract class GenericParser extends stream.Transform {
...@@ -21,7 +24,7 @@ export abstract class GenericParser extends stream.Transform { ...@@ -21,7 +24,7 @@ export abstract class GenericParser extends stream.Transform {
return; return;
} }
syncWrite(str:string, logger:any = null): any { syncWrite(str:string): any {
let error = "" let error = ""
const obj = {}; const obj = {};
this._parse(str, obj); this._parse(str, obj);
......
...@@ -211,7 +211,7 @@ export class Server extends stream.Duplex implements HookableServer { ...@@ -211,7 +211,7 @@ export class Server extends stream.Duplex implements HookableServer {
} }
async writeRawBlock(raw:string): Promise<BlockDTO> { async writeRawBlock(raw:string): Promise<BlockDTO> {
const obj = parsers.parseBlock.syncWrite(raw, logger) const obj = parsers.parseBlock.syncWrite(raw)
return await this.writeBlock(obj) return await this.writeBlock(obj)
} }
...@@ -224,7 +224,7 @@ export class Server extends stream.Duplex implements HookableServer { ...@@ -224,7 +224,7 @@ export class Server extends stream.Duplex implements HookableServer {
} }
async writeRawIdentity(raw:string): Promise<DBIdentity> { async writeRawIdentity(raw:string): Promise<DBIdentity> {
const obj = parsers.parseIdentity.syncWrite(raw, logger) const obj = parsers.parseIdentity.syncWrite(raw)
return await this.writeIdentity(obj) return await this.writeIdentity(obj)
} }
...@@ -237,7 +237,7 @@ export class Server extends stream.Duplex implements HookableServer { ...@@ -237,7 +237,7 @@ export class Server extends stream.Duplex implements HookableServer {
} }
async writeRawCertification(raw:string): Promise<CertificationDTO> { async writeRawCertification(raw:string): Promise<CertificationDTO> {
const obj = parsers.parseCertification.syncWrite(raw, logger) const obj = parsers.parseCertification.syncWrite(raw)
return await this.writeCertification(obj) return await this.writeCertification(obj)
} }
...@@ -250,7 +250,7 @@ export class Server extends stream.Duplex implements HookableServer { ...@@ -250,7 +250,7 @@ export class Server extends stream.Duplex implements HookableServer {
} }
async writeRawMembership(raw:string): Promise<MembershipDTO> { async writeRawMembership(raw:string): Promise<MembershipDTO> {
const obj = parsers.parseMembership.syncWrite(raw, logger) const obj = parsers.parseMembership.syncWrite(raw)
return await this.writeMembership(obj) return await this.writeMembership(obj)
} }
...@@ -263,7 +263,7 @@ export class Server extends stream.Duplex implements HookableServer { ...@@ -263,7 +263,7 @@ export class Server extends stream.Duplex implements HookableServer {
} }
async writeRawRevocation(raw:string): Promise<RevocationDTO> { async writeRawRevocation(raw:string): Promise<RevocationDTO> {
const obj = parsers.parseRevocation.syncWrite(raw, logger) const obj = parsers.parseRevocation.syncWrite(raw)
return await this.writeRevocation(obj) return await this.writeRevocation(obj)
} }
...@@ -276,7 +276,7 @@ export class Server extends stream.Duplex implements HookableServer { ...@@ -276,7 +276,7 @@ export class Server extends stream.Duplex implements HookableServer {
} }
async writeRawTransaction(raw:string): Promise<TransactionDTO> { async writeRawTransaction(raw:string): Promise<TransactionDTO> {
const obj = parsers.parseTransaction.syncWrite(raw, logger) const obj = parsers.parseTransaction.syncWrite(raw)
return await this.writeTransaction(obj) return await this.writeTransaction(obj)
} }
...@@ -289,7 +289,7 @@ export class Server extends stream.Duplex implements HookableServer { ...@@ -289,7 +289,7 @@ export class Server extends stream.Duplex implements HookableServer {
} }
async writeRawPeer(raw:string): Promise<PeerDTO> { async writeRawPeer(raw:string): Promise<PeerDTO> {
const obj = parsers.parsePeer.syncWrite(raw, logger) const obj = parsers.parsePeer.syncWrite(raw)
return await this.writePeer(obj) return await this.writePeer(obj)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment