X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=ts%2Fstructs%2FLogger.ts;h=ffe8b3a5394431a13548e6110bfd2d08f1d009a3;hb=f3e670e9341decac613d33fc52febf19cea32f20;hp=5c34318c2147fb2285de5a1513f46168e33e6baf;hpb=4f914d250ae903770128765403d62ce3d8f54126;p=ldk-java diff --git a/ts/structs/Logger.ts b/ts/structs/Logger.ts index 5c34318c..ffe8b3a5 100644 --- a/ts/structs/Logger.ts +++ b/ts/structs/Logger.ts @@ -1 +1,54 @@ + + +import CommonBase from './CommonBase'; +import * as bindings from '../bindings' // TODO: figure out location + + + + export class Logger extends CommonBase { + + bindings_instance?: bindings.LDKLogger; + + constructor(ptr?: number, arg?: bindings.LDKLogger) { + if (Number.isFinite(ptr)) { + super(ptr); + this.bindings_instance = null; + } else { + // TODO: private constructor instantiation + super(bindings.LDKLogger_new(arg)); + this.ptrs_to.push(arg); + + } + } + + protected finalize() { + if (this.ptr != 0) { + bindings.Logger_free(this.ptr); + } + super.finalize(); + } + + static new_impl(arg: LoggerInterface): Logger { + const impl_holder: LDKLoggerHolder = new LDKLoggerHolder(); + let structImplementation = { + // todo: in-line interface filling + log (record: number): void { + const record_hu_conv: Record = new Record(null, record); + arg.log(record_hu_conv); + }, + + + }; + impl_holder.held = new Logger (null, structImplementation); + } + } + + export interface LoggerInterface { + log(record: Record): void; + + } + + class LDKLoggerHolder { + held: Logger; + } }