@godxjp/server-sdk 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -595,3 +595,30 @@ Short version — the boilerplate's root `README.md` has the full symptom → ca
595
595
  - [ ] Move `hono` to `peerDependencies` review (already `>=4`) and keep `jose` as the only
596
596
  runtime dependency.
597
597
  - [ ] CI: `vitest run` (40) + `tsc --noEmit` + a pack-and-import smoke test on Workers and Node.
598
+
599
+ ## `./logger` — godx-logger for Workers
600
+
601
+ Ship a Worker's logs to [godx-logger](https://logger.godx.jp). Turning it on:
602
+
603
+ ```sh
604
+ npx wrangler secret put GODX_LOGGER_TOKEN # this app's ingest key (Vault; ask the platform operator)
605
+ ```
606
+
607
+ ```ts
608
+ import { godxLogger, type GodxLoggerVariables } from "@godxjp/server-sdk/logger";
609
+
610
+ type AppEnv = { Bindings: Env; Variables: GodxVariables & GodxLoggerVariables };
611
+ app.use(godxLogger()); // reads GODX_LOGGER_TOKEN (+ optional GODX_LOGGER_LEVEL/_APP/_URL, ENVIRONMENT)
612
+
613
+ app.get("/x", (c) => {
614
+ c.var.log.info("doing x", { order: 42 }); // debug | info | warn | error(msg, Error | fields)
615
+ return c.text("ok");
616
+ });
617
+ ```
618
+
619
+ Per request: `c.var.log` carries `method`, `path`, `request_id` (cf-ray); a request line is logged at the end
620
+ (`info`, `warn` for 4xx, `error` for 5xx) and a thrown error with its stack. The batch is shipped with
621
+ `executionCtx.waitUntil` — the response never waits, and a down logger never fails the request. Without a
622
+ token nothing is sent. The ingest key pins the tenant and the `app` label server-side, so every Worker of the
623
+ app lands in one log group `app:<name>`. Outside Hono: `GodxLogger.create({ token, app }).info(…)` then
624
+ `await log.flush()`.
@@ -0,0 +1,60 @@
1
+ import { Env, MiddlewareHandler } from 'hono';
2
+
3
+ /**
4
+ * godx-logger (https://logger.godx.jp) for Workers.
5
+ *
6
+ * Turning it on is one secret: `wrangler secret put GODX_LOGGER_TOKEN` (this app's ingest key,
7
+ * from the platform operator / Vault) and one line: `app.use(godxLogger())`. Every request then
8
+ * gets `c.var.log`, a request line (status, duration) is logged at the end, a thrown error is
9
+ * logged with its stack, and the batch is shipped with `executionCtx.waitUntil` — the response
10
+ * never waits for the logger, and a down logger never breaks the request.
11
+ *
12
+ * The ingest key pins the tenant and the `app` label server-side; every Worker of the app lands in
13
+ * one log group `app:<name>`.
14
+ */
15
+ type LogLevel = "debug" | "info" | "warn" | "error";
16
+ type LogFields = Record<string, unknown>;
17
+ interface GodxLoggerConfig {
18
+ /** Ingest key. Empty or missing = the logger does nothing (local dev, tests). */
19
+ token?: string;
20
+ /** Fallback app label; the key pins the real one server-side. */
21
+ app?: string;
22
+ env?: string;
23
+ /** Stream name inside the app's log group. Default "worker". */
24
+ host?: string;
25
+ /** Minimum level shipped. Default "info". */
26
+ level?: LogLevel;
27
+ endpoint?: string;
28
+ /** Records per request to the logger. Default 200. */
29
+ batchSize?: number;
30
+ /** Test seam; defaults to the global fetch. */
31
+ fetch?: typeof fetch;
32
+ }
33
+ declare class GodxLogger {
34
+ private readonly sink;
35
+ private readonly cfg;
36
+ private readonly bound;
37
+ private constructor();
38
+ static create(cfg: GodxLoggerConfig): GodxLogger;
39
+ /** A logger that adds `fields` to every record; shares the parent's buffer. */
40
+ child(fields: LogFields): GodxLogger;
41
+ debug(message: string, fields?: LogFields): void;
42
+ info(message: string, fields?: LogFields): void;
43
+ warn(message: string, fields?: LogFields): void;
44
+ error(message: string, fields?: LogFields | unknown): void;
45
+ log(level: LogLevel, message: string, fields?: LogFields): void;
46
+ /** Ship everything buffered. Never throws. */
47
+ flush(): Promise<void>;
48
+ }
49
+ type GodxLoggerVariables = {
50
+ log: GodxLogger;
51
+ };
52
+ /**
53
+ * Hono middleware: `c.var.log` for the request, a request line at the end, errors with stacks,
54
+ * shipped via waitUntil. Config comes from the Worker's bindings unless given.
55
+ */
56
+ declare function godxLogger<E extends Env & {
57
+ Variables: GodxLoggerVariables;
58
+ }>(config?: (env: E["Bindings"]) => GodxLoggerConfig): MiddlewareHandler<E>;
59
+
60
+ export { GodxLogger, type GodxLoggerConfig, type GodxLoggerVariables, type LogFields, type LogLevel, godxLogger };
package/dist/logger.js ADDED
@@ -0,0 +1,143 @@
1
+ // src/logger.ts
2
+ var RANK = { debug: 10, info: 20, warn: 30, error: 40 };
3
+ var DEFAULT_ENDPOINT = "https://logger.godx.jp/api/v1/ingest";
4
+ var MAX_MESSAGE = 32768;
5
+ var MAX_STACK = 8192;
6
+ var cut = (s, max) => s.length > max ? `${s.slice(0, max)}\u2026` : s;
7
+ function errorFields(error) {
8
+ if (!(error instanceof Error)) return { error: String(error) };
9
+ return {
10
+ "exception.class": error.name,
11
+ "exception.message": cut(error.message, MAX_MESSAGE),
12
+ "exception.stack": cut(error.stack ?? "", MAX_STACK)
13
+ };
14
+ }
15
+ var Sink = class {
16
+ constructor(cfg) {
17
+ this.cfg = cfg;
18
+ }
19
+ cfg;
20
+ lines = [];
21
+ get enabled() {
22
+ return !!this.cfg.token;
23
+ }
24
+ push(line) {
25
+ this.lines.push(line);
26
+ }
27
+ get size() {
28
+ return this.lines.length;
29
+ }
30
+ async flush() {
31
+ if (!this.enabled || this.lines.length === 0) return;
32
+ const batch = this.lines.splice(0, this.cfg.batchSize ?? 200);
33
+ const url = new URL(`${(this.cfg.endpoint ?? DEFAULT_ENDPOINT).replace(/\/$/, "")}/insert/jsonline`);
34
+ url.search = new URLSearchParams({ _stream_fields: "app,host", _time_field: "_time", _msg_field: "_msg" }).toString();
35
+ try {
36
+ await (this.cfg.fetch ?? fetch)(url, {
37
+ method: "POST",
38
+ headers: { Authorization: `Bearer ${this.cfg.token}`, "Content-Type": "application/stream+json" },
39
+ body: batch.join("\n") + "\n"
40
+ });
41
+ } catch {
42
+ }
43
+ if (this.lines.length > 0) await this.flush();
44
+ }
45
+ };
46
+ var GodxLogger = class _GodxLogger {
47
+ constructor(sink, cfg, bound) {
48
+ this.sink = sink;
49
+ this.cfg = cfg;
50
+ this.bound = bound;
51
+ }
52
+ sink;
53
+ cfg;
54
+ bound;
55
+ static create(cfg) {
56
+ return new _GodxLogger(new Sink(cfg), cfg, {});
57
+ }
58
+ /** A logger that adds `fields` to every record; shares the parent's buffer. */
59
+ child(fields) {
60
+ return new _GodxLogger(this.sink, this.cfg, { ...this.bound, ...fields });
61
+ }
62
+ debug(message, fields) {
63
+ this.log("debug", message, fields);
64
+ }
65
+ info(message, fields) {
66
+ this.log("info", message, fields);
67
+ }
68
+ warn(message, fields) {
69
+ this.log("warn", message, fields);
70
+ }
71
+ error(message, fields) {
72
+ const extra = fields instanceof Error || fields !== void 0 && typeof fields !== "object" ? errorFields(fields) : fields;
73
+ this.log("error", message, extra);
74
+ }
75
+ log(level, message, fields = {}) {
76
+ if (!this.sink.enabled || RANK[level] < RANK[this.cfg.level ?? "info"]) return;
77
+ const { error, ...rest } = fields;
78
+ this.sink.push(
79
+ JSON.stringify({
80
+ _time: (/* @__PURE__ */ new Date()).toISOString(),
81
+ _msg: cut(message, MAX_MESSAGE),
82
+ level,
83
+ app: this.cfg.app ?? "",
84
+ env: this.cfg.env ?? "production",
85
+ host: this.cfg.host ?? "worker",
86
+ ...this.bound,
87
+ ...rest,
88
+ ...error !== void 0 ? errorFields(error) : {}
89
+ })
90
+ );
91
+ }
92
+ /** Ship everything buffered. Never throws. */
93
+ flush() {
94
+ return this.sink.flush();
95
+ }
96
+ };
97
+ var isLevel = (v) => typeof v === "string" && v in RANK;
98
+ function godxLogger(config) {
99
+ return async (c, next) => {
100
+ const b = c.env ?? {};
101
+ const cfg = config ? config(c.env) : {
102
+ token: b.GODX_LOGGER_TOKEN,
103
+ app: b.GODX_LOGGER_APP,
104
+ env: b.ENVIRONMENT,
105
+ level: isLevel(b.GODX_LOGGER_LEVEL) ? b.GODX_LOGGER_LEVEL : void 0,
106
+ endpoint: b.GODX_LOGGER_URL
107
+ };
108
+ const url = new URL(c.req.url);
109
+ const log = GodxLogger.create(cfg).child({
110
+ method: c.req.method,
111
+ path: url.pathname,
112
+ request_id: c.req.header("cf-ray") ?? crypto.randomUUID()
113
+ });
114
+ c.set("log", log);
115
+ const started = Date.now();
116
+ try {
117
+ await next();
118
+ } catch (error) {
119
+ log.error("unhandled error", { error, status: 500, duration_ms: Date.now() - started });
120
+ throw error;
121
+ } finally {
122
+ const status = c.res?.status ?? 500;
123
+ if (!c.error) {
124
+ log.log(status >= 500 ? "error" : status >= 400 ? "warn" : "info", `${c.req.method} ${url.pathname} ${status}`, {
125
+ status,
126
+ duration_ms: Date.now() - started
127
+ });
128
+ } else {
129
+ log.error("request failed", { error: c.error, status, duration_ms: Date.now() - started });
130
+ }
131
+ const shipping = log.flush();
132
+ try {
133
+ c.executionCtx.waitUntil(shipping);
134
+ } catch {
135
+ }
136
+ }
137
+ };
138
+ }
139
+ export {
140
+ GodxLogger,
141
+ godxLogger
142
+ };
143
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/logger.ts"],"sourcesContent":["import type { Context, Env, MiddlewareHandler } from \"hono\";\n\n/**\n * godx-logger (https://logger.godx.jp) for Workers.\n *\n * Turning it on is one secret: `wrangler secret put GODX_LOGGER_TOKEN` (this app's ingest key,\n * from the platform operator / Vault) and one line: `app.use(godxLogger())`. Every request then\n * gets `c.var.log`, a request line (status, duration) is logged at the end, a thrown error is\n * logged with its stack, and the batch is shipped with `executionCtx.waitUntil` — the response\n * never waits for the logger, and a down logger never breaks the request.\n *\n * The ingest key pins the tenant and the `app` label server-side; every Worker of the app lands in\n * one log group `app:<name>`.\n */\n\nexport type LogLevel = \"debug\" | \"info\" | \"warn\" | \"error\";\nconst RANK: Record<LogLevel, number> = { debug: 10, info: 20, warn: 30, error: 40 };\n\nexport type LogFields = Record<string, unknown>;\n\nexport interface GodxLoggerConfig {\n /** Ingest key. Empty or missing = the logger does nothing (local dev, tests). */\n token?: string;\n /** Fallback app label; the key pins the real one server-side. */\n app?: string;\n env?: string;\n /** Stream name inside the app's log group. Default \"worker\". */\n host?: string;\n /** Minimum level shipped. Default \"info\". */\n level?: LogLevel;\n endpoint?: string;\n /** Records per request to the logger. Default 200. */\n batchSize?: number;\n /** Test seam; defaults to the global fetch. */\n fetch?: typeof fetch;\n}\n\nconst DEFAULT_ENDPOINT = \"https://logger.godx.jp/api/v1/ingest\";\nconst MAX_MESSAGE = 32_768;\nconst MAX_STACK = 8_192;\n\nconst cut = (s: string, max: number) => (s.length > max ? `${s.slice(0, max)}…` : s);\n\nfunction errorFields(error: unknown): LogFields {\n if (!(error instanceof Error)) return { error: String(error) };\n return {\n \"exception.class\": error.name,\n \"exception.message\": cut(error.message, MAX_MESSAGE),\n \"exception.stack\": cut(error.stack ?? \"\", MAX_STACK),\n };\n}\n\n/** Shared buffer behind a logger and its children. */\nclass Sink {\n private lines: string[] = [];\n\n constructor(private readonly cfg: GodxLoggerConfig) {}\n\n get enabled(): boolean {\n return !!this.cfg.token;\n }\n\n push(line: string): void {\n this.lines.push(line);\n }\n\n get size(): number {\n return this.lines.length;\n }\n\n async flush(): Promise<void> {\n if (!this.enabled || this.lines.length === 0) return;\n const batch = this.lines.splice(0, this.cfg.batchSize ?? 200);\n const url = new URL(`${(this.cfg.endpoint ?? DEFAULT_ENDPOINT).replace(/\\/$/, \"\")}/insert/jsonline`);\n url.search = new URLSearchParams({ _stream_fields: \"app,host\", _time_field: \"_time\", _msg_field: \"_msg\" }).toString();\n try {\n await (this.cfg.fetch ?? fetch)(url, {\n method: \"POST\",\n headers: { Authorization: `Bearer ${this.cfg.token}`, \"Content-Type\": \"application/stream+json\" },\n body: batch.join(\"\\n\") + \"\\n\",\n });\n } catch {\n // A log line is not worth the request.\n }\n if (this.lines.length > 0) await this.flush();\n }\n}\n\nexport class GodxLogger {\n private constructor(\n private readonly sink: Sink,\n private readonly cfg: GodxLoggerConfig,\n private readonly bound: LogFields,\n ) {}\n\n static create(cfg: GodxLoggerConfig): GodxLogger {\n return new GodxLogger(new Sink(cfg), cfg, {});\n }\n\n /** A logger that adds `fields` to every record; shares the parent's buffer. */\n child(fields: LogFields): GodxLogger {\n return new GodxLogger(this.sink, this.cfg, { ...this.bound, ...fields });\n }\n\n debug(message: string, fields?: LogFields): void {\n this.log(\"debug\", message, fields);\n }\n info(message: string, fields?: LogFields): void {\n this.log(\"info\", message, fields);\n }\n warn(message: string, fields?: LogFields): void {\n this.log(\"warn\", message, fields);\n }\n error(message: string, fields?: LogFields | unknown): void {\n const extra = fields instanceof Error || (fields !== undefined && typeof fields !== \"object\")\n ? errorFields(fields)\n : (fields as LogFields | undefined);\n this.log(\"error\", message, extra);\n }\n\n log(level: LogLevel, message: string, fields: LogFields = {}): void {\n if (!this.sink.enabled || RANK[level] < RANK[this.cfg.level ?? \"info\"]) return;\n const { error, ...rest } = fields;\n this.sink.push(\n JSON.stringify({\n _time: new Date().toISOString(),\n _msg: cut(message, MAX_MESSAGE),\n level,\n app: this.cfg.app ?? \"\",\n env: this.cfg.env ?? \"production\",\n host: this.cfg.host ?? \"worker\",\n ...this.bound,\n ...rest,\n ...(error !== undefined ? errorFields(error) : {}),\n }),\n );\n }\n\n /** Ship everything buffered. Never throws. */\n flush(): Promise<void> {\n return this.sink.flush();\n }\n}\n\nexport type GodxLoggerVariables = { log: GodxLogger };\n\ntype LoggerBindings = {\n GODX_LOGGER_TOKEN?: string;\n GODX_LOGGER_APP?: string;\n GODX_LOGGER_LEVEL?: string;\n GODX_LOGGER_URL?: string;\n ENVIRONMENT?: string;\n};\n\nconst isLevel = (v: unknown): v is LogLevel => typeof v === \"string\" && v in RANK;\n\n/**\n * Hono middleware: `c.var.log` for the request, a request line at the end, errors with stacks,\n * shipped via waitUntil. Config comes from the Worker's bindings unless given.\n */\nexport function godxLogger<E extends Env & { Variables: GodxLoggerVariables }>(\n config?: (env: E[\"Bindings\"]) => GodxLoggerConfig,\n): MiddlewareHandler<E> {\n return async (c: Context<E>, next) => {\n const b = (c.env ?? {}) as LoggerBindings;\n const cfg: GodxLoggerConfig = config\n ? config(c.env)\n : {\n token: b.GODX_LOGGER_TOKEN,\n app: b.GODX_LOGGER_APP,\n env: b.ENVIRONMENT,\n level: isLevel(b.GODX_LOGGER_LEVEL) ? b.GODX_LOGGER_LEVEL : undefined,\n endpoint: b.GODX_LOGGER_URL,\n };\n const url = new URL(c.req.url);\n const log = GodxLogger.create(cfg).child({\n method: c.req.method,\n path: url.pathname,\n request_id: c.req.header(\"cf-ray\") ?? crypto.randomUUID(),\n });\n c.set(\"log\", log);\n\n const started = Date.now();\n try {\n await next();\n } catch (error) {\n log.error(\"unhandled error\", { error, status: 500, duration_ms: Date.now() - started });\n throw error;\n } finally {\n const status = c.res?.status ?? 500;\n if (!c.error) {\n log.log(status >= 500 ? \"error\" : status >= 400 ? \"warn\" : \"info\", `${c.req.method} ${url.pathname} ${status}`, {\n status,\n duration_ms: Date.now() - started,\n });\n } else {\n log.error(\"request failed\", { error: c.error, status, duration_ms: Date.now() - started });\n }\n const shipping = log.flush();\n try {\n c.executionCtx.waitUntil(shipping);\n } catch {\n // No execution context (tests, Node): the promise still runs.\n }\n }\n };\n}\n"],"mappings":";AAgBA,IAAM,OAAiC,EAAE,OAAO,IAAI,MAAM,IAAI,MAAM,IAAI,OAAO,GAAG;AAqBlF,IAAM,mBAAmB;AACzB,IAAM,cAAc;AACpB,IAAM,YAAY;AAElB,IAAM,MAAM,CAAC,GAAW,QAAiB,EAAE,SAAS,MAAM,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC,WAAM;AAElF,SAAS,YAAY,OAA2B;AAC9C,MAAI,EAAE,iBAAiB,OAAQ,QAAO,EAAE,OAAO,OAAO,KAAK,EAAE;AAC7D,SAAO;AAAA,IACL,mBAAmB,MAAM;AAAA,IACzB,qBAAqB,IAAI,MAAM,SAAS,WAAW;AAAA,IACnD,mBAAmB,IAAI,MAAM,SAAS,IAAI,SAAS;AAAA,EACrD;AACF;AAGA,IAAM,OAAN,MAAW;AAAA,EAGT,YAA6B,KAAuB;A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{
2
2
  "name": "@godxjp/server-sdk",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "GoDX server-side SDK (Workers/Node) — holds service credentials; for browser code use @godxjp/web-sdk. Counterpart of godx-jp/php-sdk.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -62,6 +62,13 @@
62
62
  "worker": "./dist/producer.js",
63
63
  "browser": "./dist/browser-guard.js",
64
64
  "default": "./dist/producer.js"
65
+ },
66
+ "./logger": {
67
+ "types": "./dist/logger.d.ts",
68
+ "workerd": "./dist/logger.js",
69
+ "worker": "./dist/logger.js",
70
+ "browser": "./dist/browser-guard.js",
71
+ "default": "./dist/logger.js"
65
72
  }
66
73
  },
67
74
  "scripts": {
@@ -93,4 +100,4 @@
93
100
  "publishConfig": {
94
101
  "access": "public"
95
102
  }
96
- }
103
+ }