@logkit/client
Advanced tools
Comparing version 0.0.0-69a39a4 to 0.0.0-7fe532d
/** | ||
* Log an event to the Logkit ingestion endpoints. | ||
* | ||
* By default, this package does not have correct TypeScript type. To fix this, | ||
* you need to generate the declarations as part of the logkit generate step: | ||
* | ||
* ```sh | ||
* npx @logkit/logkit generate | ||
* ``` | ||
* | ||
* Make sure to check in the generated declarations to source control. | ||
*/ | ||
export declare function log(event: never, fields: never): void; | ||
export declare function log(event: string, payload: {}): Promise<void>; | ||
export declare function setUrl(url: string): void; | ||
export declare function setMode(mode: "dev" | "prod"): void; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,2 +0,2 @@ | ||
"use strict";var i=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var p=(t,o)=>{for(var n in o)i(t,n,{get:o[n],enumerable:!0})},r=(t,o,n,l)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of g(o))!h.call(t,e)&&e!==n&&i(t,e,{get:()=>o[e],enumerable:!(l=c(o,e))||l.enumerable});return t};var s=t=>r(i({},"__esModule",{value:!0}),t);var d={};p(d,{log:()=>a});module.exports=s(d);function a(t,o){fetch("http://localhost:3001/ingest",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({event:t,fields:o})}),console.log("[logkit]",t,o)}0&&(module.exports={log}); | ||
"use strict";var s=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var u=(e,o)=>{for(var r in o)s(e,r,{get:o[r],enumerable:!0})},f=(e,o,r,l)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of p(o))!v.call(e,t)&&t!==r&&s(e,t,{get:()=>o[t],enumerable:!(l=c(o,t))||l.enumerable});return e};var L=e=>f(s({},"__esModule",{value:!0}),e);var _={};u(_,{log:()=>g,setMode:()=>U,setUrl:()=>a});module.exports=L(_);var n=null;typeof process<"u"&&"env"in process&&(typeof process.env.NEXT_PUBLIC_LOGKIT_URL=="string"?n=process.env.NEXT_PUBLIC_LOGKIT_URL:typeof process.env.LOGKIT_URL=="string"&&(n=process.env.LOGKIT_URL));async function g(e,o){if(d()==="dev"){console.log("[logkit]",e,o);return}if(n===null){console.warn("[logkit] Logkit URL not set. Please set the LOGKIT_URL environment variable or use `Logkit.setUrl()`.");return}try{await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({event:e,payload:o,mode:d()}),keepalive:!0})}catch{}}function a(e){n=e}var i=null;function U(e){i=e}function d(){if(i!==null)return i;try{let e=process.env.NODE_ENV;if(e==="development"||e==="test")return"dev"}catch{}return"prod"}0&&(module.exports={log,setMode,setUrl}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@logkit/client", | ||
"version": "0.0.0-69a39a4", | ||
"version": "0.0.0-7fe532d", | ||
"description": "Next generation logging infrastructure", | ||
@@ -12,11 +12,9 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@types/node": "^18.15.13" | ||
"@types/node": "^20.2.5" | ||
}, | ||
"scripts": { | ||
"build": "concurrently \"node -r esbuild-register scripts/build.ts --minify\" \"pnpm tsc -p scripts/tsconfig.extract.json\"", | ||
"dev": "concurrently \"node -r esbuild-register --watch --watch-path src scripts/build.ts\" \"pnpm tsc -p scripts/tsconfig.extract.json --watch\"", | ||
"check": "concurrently \"pnpm check:typescript\" \"pnpm check:lint\"", | ||
"check:typescript": "tsc", | ||
"check:lint": "eslint --ext .js,.jsx,.ts,.tsx src/ scripts/" | ||
"build": "concurrently -n client:build,client:types \"node -r esbuild-register scripts/build.ts --minify\" \"pnpm tsc -p scripts/tsconfig.extract.json\"", | ||
"dev": "concurrently -n client:build,client:types \"node -r esbuild-register --watch --watch-path src scripts/build.ts\" \"pnpm tsc -p scripts/tsconfig.extract.json --watch\"", | ||
"check": "tsc" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
6322
12