From c6b038b868893cdba5f16e7e0b81418b837aa207 Mon Sep 17 00:00:00 2001 From: Paul Razvan Berg Date: Sat, 3 May 2025 11:23:13 +0300 Subject: [PATCH 1/2] fix: fix log namespace --- packages/ts/index.ts | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/packages/ts/index.ts b/packages/ts/index.ts index d0ac26249..19da31744 100644 --- a/packages/ts/index.ts +++ b/packages/ts/index.ts @@ -82,12 +82,10 @@ function format(fmt: string, args: string[]): string { return out; } -// Host interface for logging -export declare namespace log { - // Host export for logging, providing basic logging functionality - export function log(level: Level, msg: string): void; -} +// Host export for logging, providing basic logging functionality +export declare function log(level: log.Level, msg: string): void; +// Host interface for logging export namespace log { export enum Level { CRITICAL = 0, @@ -104,7 +102,7 @@ export namespace log { * @param args Format string arguments. */ export function critical(msg: string, args: Array): void { - log.log(Level.CRITICAL, format(msg, args)); + log(Level.CRITICAL, format(msg, args)); } /** @@ -114,7 +112,7 @@ export namespace log { * @param args Format string arguments. */ export function error(msg: string, args: Array): void { - log.log(Level.ERROR, format(msg, args)); + log(Level.ERROR, format(msg, args)); } /** Logs a warning message. @@ -123,7 +121,7 @@ export namespace log { * @param args Format string arguments. */ export function warning(msg: string, args: Array): void { - log.log(Level.WARNING, format(msg, args)); + log(Level.WARNING, format(msg, args)); } /** Logs an info message. @@ -132,7 +130,7 @@ export namespace log { * @param args Format string arguments. */ export function info(msg: string, args: Array): void { - log.log(Level.INFO, format(msg, args)); + log(Level.INFO, format(msg, args)); } /** Logs a debug message. @@ -141,7 +139,7 @@ export namespace log { * @param args Format string arguments. */ export function debug(msg: string, args: Array): void { - log.log(Level.DEBUG, format(msg, args)); + log(Level.DEBUG, format(msg, args)); } } From 1c92f99111940121ee6ac661ddb4cb8e26ed7fd1 Mon Sep 17 00:00:00 2001 From: YaroShkvorets Date: Mon, 23 Jun 2025 16:11:17 -0400 Subject: [PATCH 2/2] changeset --- .changeset/pretty-cows-tie.md | 5 +++++ packages/ts/index.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/pretty-cows-tie.md diff --git a/.changeset/pretty-cows-tie.md b/.changeset/pretty-cows-tie.md new file mode 100644 index 000000000..cd34f756d --- /dev/null +++ b/.changeset/pretty-cows-tie.md @@ -0,0 +1,5 @@ +--- +'@graphprotocol/graph-ts': patch +--- + +fixed log namespace reference diff --git a/packages/ts/index.ts b/packages/ts/index.ts index 5823e98a2..a49880384 100644 --- a/packages/ts/index.ts +++ b/packages/ts/index.ts @@ -101,7 +101,7 @@ export namespace log { * @param msg Format string a la "Value = {}, other = {}". * @param args Format string arguments. */ -export function critical(msg: string, args: Array): never { + export function critical(msg: string, args: Array): never { const message = format(msg, args); log(Level.CRITICAL, message); throw new Error(message);