3 import CommonBase from './CommonBase';
4 import * as bindings from '../bindings' // TODO: figure out location
8 export class Logger extends CommonBase {
10 bindings_instance?: bindings.LDKLogger;
12 constructor(ptr?: number, arg?: bindings.LDKLogger) {
13 if (Number.isFinite(ptr)) {
15 this.bindings_instance = null;
17 // TODO: private constructor instantiation
18 super(bindings.LDKLogger_new(arg));
19 this.ptrs_to.push(arg);
24 protected finalize() {
26 bindings.Logger_free(this.ptr);
31 static new_impl(arg: LoggerInterface): Logger {
32 const impl_holder: LDKLoggerHolder = new LDKLoggerHolder();
33 let structImplementation = <bindings.LDKLogger>{
34 // todo: in-line interface filling
35 log (record: String): void {
41 impl_holder.held = new Logger (null, structImplementation);
45 export interface LoggerInterface {
46 log(record: String): void;
50 class LDKLoggerHolder {