logan-logger 1.1.19 → 1.1.20
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 +4 -1
- package/dist/browser.cjs +1 -0
- package/dist/browser.d.cts +25 -0
- package/dist/browser.d.mts +25 -0
- package/dist/{browser.esm.js → browser.mjs} +2 -2
- package/dist/bun.cjs +1 -0
- package/dist/bun.d.cts +7 -0
- package/dist/bun.d.mts +7 -0
- package/dist/{bun.esm.js → bun.mjs} +3 -3
- package/dist/chunks/__vite-browser-external-DWL5uGdo.cjs +1 -0
- package/dist/chunks/factory-B8mZAA08.cjs +1 -0
- package/dist/chunks/formatting-D6Y8pN18.cjs +1 -0
- package/dist/core/factory.d.cts +46 -0
- package/dist/core/factory.d.mts +46 -0
- package/dist/core/logger.d.cts +19 -0
- package/dist/core/logger.d.mts +19 -0
- package/dist/core/types.d.cts +170 -0
- package/dist/core/types.d.mts +170 -0
- package/dist/deno.cjs +1 -0
- package/dist/deno.d.cts +7 -0
- package/dist/deno.d.mts +7 -0
- package/dist/{deno.esm.js → deno.mjs} +3 -3
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +19 -0
- package/dist/index.d.mts +19 -0
- package/dist/{index.esm.js → index.mjs} +3 -3
- package/dist/node.cjs +1 -0
- package/dist/node.d.cts +3 -0
- package/dist/node.d.mts +3 -0
- package/dist/{node.esm.js → node.mjs} +1 -1
- package/dist/runtime/browser.d.cts +31 -0
- package/dist/runtime/browser.d.mts +31 -0
- package/dist/runtime/node.d.cts +16 -0
- package/dist/runtime/node.d.mts +16 -0
- package/dist/utils/config.d.cts +5 -0
- package/dist/utils/config.d.mts +5 -0
- package/dist/utils/formatting.d.cts +31 -0
- package/dist/utils/formatting.d.mts +31 -0
- package/dist/utils/runtime.d.cts +31 -0
- package/dist/utils/runtime.d.mts +31 -0
- package/dist/utils/serialization.d.cts +33 -0
- package/dist/utils/serialization.d.mts +33 -0
- package/package.json +70 -19
- package/dist/__vite-browser-external-DcEHEw3a.js +0 -1
- package/dist/browser.js +0 -1
- package/dist/bun.js +0 -1
- package/dist/deno.js +0 -1
- package/dist/factory-Uhw2LFdb.js +0 -1
- package/dist/formatting-BHJ25M3U.js +0 -1
- package/dist/index.js +0 -1
- package/dist/node.js +0 -1
- /package/dist/{__vite-browser-external-C71mkwFX.mjs → chunks/__vite-browser-external-C71mkwFX.mjs} +0 -0
- /package/dist/{browser-D9bA4EUQ.js → chunks/browser-D9bA4EUQ.cjs} +0 -0
- /package/dist/{browser-DV_BQqDK.mjs → chunks/browser-DV_BQqDK.mjs} +0 -0
- /package/dist/{factory-CG8zWIqv.mjs → chunks/factory-CG8zWIqv.mjs} +0 -0
- /package/dist/{formatting-DP_57uSR.mjs → chunks/formatting-DP_57uSR.mjs} +0 -0
package/README.md
CHANGED
|
@@ -59,6 +59,9 @@ const requestLogger = logger.child({
|
|
|
59
59
|
requestLogger.info('Processing request', { endpoint: '/api/users' });
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
+
Use named imports from `logan-logger` and its runtime subpaths. Default imports
|
|
63
|
+
are not part of the public API.
|
|
64
|
+
|
|
62
65
|
### Next.js Integration
|
|
63
66
|
|
|
64
67
|
Logan Logger is fully compatible with Next.js 13+ App Router, including Server Components, Client Components, and API Routes.
|
|
@@ -362,4 +365,4 @@ MIT License - see LICENSE file for details.
|
|
|
362
365
|
|
|
363
366
|
## Credits
|
|
364
367
|
|
|
365
|
-
Created by Logan Lindquist Land
|
|
368
|
+
Created by Logan Lindquist Land
|
package/dist/browser.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./chunks/browser-D9bA4EUQ.cjs"),t=require("./chunks/formatting-D6Y8pN18.cjs");function n(){let t=e.l();return{level:e.c.INFO,format:`text`,timestamp:!0,colorize:t.capabilities.colorSupport,metadata:{},transports:[{type:`console`,options:{}}]}}function r(){return typeof process<`u`&&process.env?process.env.NODE_ENV||process.env.NEXT_PUBLIC_APP_ENV||process.env.ENVIRONMENT||`development`:typeof window<`u`&&globalThis.__ENV__||`development`}function i(t){switch(t){case`production`:return e.c.ERROR;case`staging`:case`test`:return e.c.WARN;case`development`:case`dev`:return e.c.DEBUG;default:return e.c.INFO}}function a(t={}){let r=n(),i={...r,...t,metadata:{...r.metadata,...t.metadata}};return new e.t(i)}function o(){let e=r();return a({level:i(e),colorize:e!==`production`,timestamp:!0,format:e===`production`?`json`:`text`})}var s=o(),c={debug:(e,t)=>s.debug(e,t),info:(e,t)=>s.info(e,t),warn:(e,t)=>s.warn(e,t),error:(e,t)=>s.error(e,t)};exports.BrowserLogger=e.t,exports.ConsoleGroupLogger=e.n,exports.LogLevel=e.c,exports.PerformanceLogger=e.r,exports.createLogger=a,exports.createLoggerForEnvironment=o,exports.detectRuntime=e.l,exports.filterSensitiveData=e.i,exports.formatLevel=t.t,exports.formatLogEntry=t.n,exports.isBrowser=e.u,exports.isBun=e.d,exports.isDeno=e.f,exports.isNode=e.p,exports.log=c,exports.logger=s,exports.safeStringify=e.a,exports.serializeError=e.o;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ILogger, LoggerConfig } from './core/types.cjs';
|
|
2
|
+
export type { ILogger, LoggerConfig } from './core/types.cjs';
|
|
3
|
+
export { LogLevel } from './core/types.cjs';
|
|
4
|
+
export { BrowserLogger, ConsoleGroupLogger, PerformanceLogger } from './runtime/browser.cjs';
|
|
5
|
+
export * from './utils/formatting.cjs';
|
|
6
|
+
export * from './utils/runtime.cjs';
|
|
7
|
+
export * from './utils/serialization.cjs';
|
|
8
|
+
/**
|
|
9
|
+
* Browser-specific logger factory function.
|
|
10
|
+
* Creates a BrowserLogger instance without importing Node.js dependencies.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createLogger(config?: Partial<LoggerConfig>): ILogger;
|
|
13
|
+
/**
|
|
14
|
+
* Create a browser logger with configuration based on the current environment.
|
|
15
|
+
* Automatically detects production/development/test environments and
|
|
16
|
+
* sets appropriate log levels and formatting.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createLoggerForEnvironment(): ILogger;
|
|
19
|
+
export declare const logger: ILogger;
|
|
20
|
+
export declare const log: {
|
|
21
|
+
debug: (message: string, meta?: any) => void;
|
|
22
|
+
info: (message: string, meta?: any) => void;
|
|
23
|
+
warn: (message: string, meta?: any) => void;
|
|
24
|
+
error: (message: string, meta?: any) => void;
|
|
25
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ILogger, LoggerConfig } from './core/types.mjs';
|
|
2
|
+
export type { ILogger, LoggerConfig } from './core/types.mjs';
|
|
3
|
+
export { LogLevel } from './core/types.mjs';
|
|
4
|
+
export { BrowserLogger, ConsoleGroupLogger, PerformanceLogger } from './runtime/browser.mjs';
|
|
5
|
+
export * from './utils/formatting.mjs';
|
|
6
|
+
export * from './utils/runtime.mjs';
|
|
7
|
+
export * from './utils/serialization.mjs';
|
|
8
|
+
/**
|
|
9
|
+
* Browser-specific logger factory function.
|
|
10
|
+
* Creates a BrowserLogger instance without importing Node.js dependencies.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createLogger(config?: Partial<LoggerConfig>): ILogger;
|
|
13
|
+
/**
|
|
14
|
+
* Create a browser logger with configuration based on the current environment.
|
|
15
|
+
* Automatically detects production/development/test environments and
|
|
16
|
+
* sets appropriate log levels and formatting.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createLoggerForEnvironment(): ILogger;
|
|
19
|
+
export declare const logger: ILogger;
|
|
20
|
+
export declare const log: {
|
|
21
|
+
debug: (message: string, meta?: any) => void;
|
|
22
|
+
info: (message: string, meta?: any) => void;
|
|
23
|
+
warn: (message: string, meta?: any) => void;
|
|
24
|
+
error: (message: string, meta?: any) => void;
|
|
25
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, p as c, r as l, t as u, u as d } from "./browser-DV_BQqDK.mjs";
|
|
2
|
-
import { n as f, t as p } from "./formatting-DP_57uSR.mjs";
|
|
1
|
+
import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, p as c, r as l, t as u, u as d } from "./chunks/browser-DV_BQqDK.mjs";
|
|
2
|
+
import { n as f, t as p } from "./chunks/formatting-DP_57uSR.mjs";
|
|
3
3
|
//#region src/browser.ts
|
|
4
4
|
function m() {
|
|
5
5
|
let e = a();
|
package/dist/bun.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./chunks/factory-B8mZAA08.cjs"),t=require("./chunks/browser-D9bA4EUQ.cjs"),n=require("./chunks/formatting-D6Y8pN18.cjs");exports.NodeLogger=e.u,exports.createLogger=e.n,exports.createLoggerForEnvironment=e.r,exports.detectRuntime=t.l,exports.filterSensitiveData=t.i,exports.formatLevel=n.t,exports.formatLogEntry=n.n,exports.getDefaultConfig=e.o,exports.isBrowser=t.u,exports.isBun=t.d,exports.isDeno=t.f,exports.isNode=t.p,exports.loadConfigFromEnvironment=e.s,exports.loadConfigFromFile=e.c,exports.mergeConfigs=e.l,exports.safeStringify=t.a,exports.serializeError=t.o;
|
package/dist/bun.d.cts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createLogger, createLoggerForEnvironment } from './core/factory.cjs';
|
|
2
|
+
export type { ILogger, LoggerConfig, LogLevel } from './core/types.cjs';
|
|
3
|
+
export { NodeLogger } from './runtime/node.cjs';
|
|
4
|
+
export * from './utils/config.cjs';
|
|
5
|
+
export * from './utils/formatting.cjs';
|
|
6
|
+
export * from './utils/runtime.cjs';
|
|
7
|
+
export * from './utils/serialization.cjs';
|
package/dist/bun.d.mts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createLogger, createLoggerForEnvironment } from './core/factory.mjs';
|
|
2
|
+
export type { ILogger, LoggerConfig, LogLevel } from './core/types.mjs';
|
|
3
|
+
export { NodeLogger } from './runtime/node.mjs';
|
|
4
|
+
export * from './utils/config.mjs';
|
|
5
|
+
export * from './utils/formatting.mjs';
|
|
6
|
+
export * from './utils/runtime.mjs';
|
|
7
|
+
export * from './utils/serialization.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as e, l as t, n, o as r, r as i, s as a, u as o } from "./factory-CG8zWIqv.mjs";
|
|
2
|
-
import { a as s, d as c, f as l, i as u, l as d, o as f, p, u as m } from "./browser-DV_BQqDK.mjs";
|
|
3
|
-
import { n as h, t as g } from "./formatting-DP_57uSR.mjs";
|
|
1
|
+
import { c as e, l as t, n, o as r, r as i, s as a, u as o } from "./chunks/factory-CG8zWIqv.mjs";
|
|
2
|
+
import { a as s, d as c, f as l, i as u, l as d, o as f, p, u as m } from "./chunks/browser-DV_BQqDK.mjs";
|
|
3
|
+
import { n as h, t as g } from "./chunks/formatting-DP_57uSR.mjs";
|
|
4
4
|
export { o as NodeLogger, n as createLogger, i as createLoggerForEnvironment, d as detectRuntime, u as filterSensitiveData, g as formatLevel, h as formatLogEntry, r as getDefaultConfig, m as isBrowser, c as isBun, l as isDeno, p as isNode, a as loadConfigFromEnvironment, e as loadConfigFromFile, t as mergeConfigs, s as safeStringify, f as serializeError };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=require("./factory-B8mZAA08.cjs").f(((e,t)=>{t.exports={}}));Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return e()}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));const l=require("./browser-D9bA4EUQ.cjs");var u=class e extends l.s{constructor(e={}){super(e),this.initializeWinston()}async initializeWinston(){try{let e=await import(`winston`);this.winston=this.createWinstonLogger(e)}catch(e){console.warn(`[logan-logger] Winston not found, falling back to console logging:`,e)}}createWinstonLogger(e){let t=e.format.combine(e.format.timestamp({format:`YYYY-MM-DD HH:mm:ss`}),e.format.errors({stack:!0}),e.format.json(),e.format.prettyPrint()),n=e.format.combine(e.format.colorize(),e.format.timestamp({format:`HH:mm:ss`}),e.format.printf(({timestamp:e,level:t,message:n,...r})=>`${e} [${t}]: ${n} ${Object.keys(r).length?JSON.stringify(r,null,2):``}`)),r=e.createLogger({level:this.getWinstonLevel(this.level),format:t,transports:[new e.transports.Console({format:process.env.NODE_ENV===`production`?t:n})]});return process.env.NODE_ENV===`production`&&(r.add(new e.transports.File({filename:`logs/error.log`,level:`error`,maxsize:5242880,maxFiles:5})),r.add(new e.transports.File({filename:`logs/combined.log`,maxsize:5242880,maxFiles:10}))),r}writeLog(e){this.winston?this.winston.log({level:this.getWinstonLevel(e.level),message:e.message,timestamp:e.timestamp,...e.metadata}):this.writeToConsole(e)}createChild(){return new e(this.config)}writeToConsole(e){let t=e.timestamp.toISOString(),n=l.c[e.level].toLowerCase(),r=e.metadata?` ${l.a(e.metadata)}`:``,i=`[${t}] ${n.toUpperCase()}: ${e.message}${r}`;switch(e.level){case l.c.DEBUG:console.debug(i);break;case l.c.INFO:console.info(i);break;case l.c.WARN:console.warn(i);break;case l.c.ERROR:console.error(i)}}getWinstonLevel(e){switch(e){case l.c.DEBUG:return`debug`;case l.c.INFO:return`info`;case l.c.WARN:return`warn`;case l.c.ERROR:return`error`;default:return`info`}}setLevel(e){super.setLevel(e),this.winston&&(this.winston.level=this.getWinstonLevel(e))}};function d(e){return{write:t=>{e.info(t.trim())}}}function f(){let e=l.l();return{level:l.c.INFO,format:`text`,timestamp:!0,colorize:e.capabilities.colorSupport,metadata:{},transports:[{type:`console`,options:{}}]}}function p(){let e={};if(typeof process<`u`&&process.env){let t=process.env;t.LOG_LEVEL&&(e.level=v(t.LOG_LEVEL)),t.LOG_FORMAT&&[`json`,`text`].includes(t.LOG_FORMAT)&&(e.format=t.LOG_FORMAT),t.LOG_TIMESTAMP&&(e.timestamp=t.LOG_TIMESTAMP.toLowerCase()===`true`),t.LOG_COLOR&&(e.colorize=t.LOG_COLOR.toLowerCase()===`true`)}return e}async function m(e){let t=l.l();if(!t.capabilities.fileSystem)return{};let n=e?[e]:[`logan.config.json`,`logan.config.js`,`.loganrc`,`package.json`];for(let e of n)try{if(t.name===`node`)return await h(e);if(t.name===`deno`)return await g(e);if(t.name===`bun`)return await _(e)}catch{}return{}}async function h(e){try{let t=await Promise.resolve().then(()=>c(require("./__vite-browser-external-DWL5uGdo.cjs").default)),n=await Promise.resolve().then(()=>c(require("./__vite-browser-external-DWL5uGdo.cjs").default));if(e.endsWith(`.json`)){let n=await t.readFile(e,`utf-8`),r=JSON.parse(n);return e===`package.json`?r.logan||{}:r}if(e.endsWith(`.js`)){let t=await import(`file://${n.resolve(e)}`);return t.default||t}}catch{}return{}}async function g(e){try{if(e.endsWith(`.json`)){let t=await globalThis.Deno.readTextFile(e),n=JSON.parse(t);return e===`package.json`?n.logan||{}:n}if(e.endsWith(`.js`)){let t=await import(`./${e}`);return t.default||t}}catch{}return{}}async function _(e){return h(e)}function v(e){switch(e.toLowerCase()){case`debug`:return l.c.DEBUG;case`info`:return l.c.INFO;case`warn`:case`warning`:return l.c.WARN;case`error`:return l.c.ERROR;case`silent`:case`none`:return l.c.SILENT;default:return l.c.INFO}}function y(...e){let t=f();return e.reduce((e,t)=>({...e,...t,metadata:{...e.metadata,...t.metadata},transports:t.transports||e.transports}),t)}var b=class e{static create(t={}){let n=l.l(),r=e.mergeConfig(t);switch(n.name){case`node`:return new u(r);case`deno`:return new l.t(r);case`bun`:return new u(r);case`browser`:case`webworker`:return new l.t(r);default:return new l.t(r)}}static createChild(e,t){return e.child(t)}static mergeConfig(e){let t=f();return{...t,...e,metadata:{...t.metadata,...e.metadata}}}};function x(e){return b.create(e)}function S(){let e=C();return x({level:w(e),colorize:e!==`production`,timestamp:!0,format:e===`production`?`json`:`text`})}function C(){return typeof process<`u`&&process.env?process.env.NODE_ENV||process.env.NEXT_PUBLIC_APP_ENV||process.env.ENVIRONMENT||`development`:typeof window<`u`&&globalThis.__ENV__||`development`}function w(e){switch(e){case`production`:return l.c.ERROR;case`staging`:case`test`:return l.c.WARN;case`development`:case`dev`:return l.c.DEBUG;default:return l.c.INFO}}function T(e){switch(e.toLowerCase()){case`debug`:return l.c.DEBUG;case`info`:return l.c.INFO;case`warn`:case`warning`:return l.c.WARN;case`error`:return l.c.ERROR;case`silent`:case`none`:return l.c.SILENT;default:return l.c.INFO}}function E(e){switch(e){case l.c.DEBUG:return`debug`;case l.c.INFO:return`info`;case l.c.WARN:return`warn`;case l.c.ERROR:return`error`;case l.c.SILENT:return`silent`;default:return`info`}}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return u}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./browser-D9bA4EUQ.cjs");function t(t,n=`text`){if(n===`json`){let n={timestamp:t.timestamp.toISOString(),level:e.c[t.level].toLowerCase(),message:t.message,runtime:t.runtime};return t.metadata!==void 0&&(n.metadata=t.metadata),e.a(n)}let r=t.timestamp.toISOString(),i=e.c[t.level].toUpperCase(),a=t.metadata?` ${e.a(t.metadata)}`:``;return`[${r}] ${i}: ${t.message}${a}`}function n(t,n=!1){let r=e.c[t].toUpperCase();if(!n)return r;let i={[e.c.DEBUG]:`\x1B[36m`,[e.c.INFO]:`\x1B[32m`,[e.c.WARN]:`\x1B[33m`,[e.c.ERROR]:`\x1B[31m`,[e.c.SILENT]:`\x1B[37m`};return`${i[t]||i[e.c.INFO]}${r}[0m`}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return n}});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ILogger, LoggerConfig, LogLevel } from './types.cjs';
|
|
2
|
+
/**
|
|
3
|
+
* Factory class for creating logger instances based on the detected runtime.
|
|
4
|
+
*/
|
|
5
|
+
export declare class LoggerFactory {
|
|
6
|
+
/**
|
|
7
|
+
* Create a logger instance appropriate for the current runtime.
|
|
8
|
+
* @param config - Optional configuration for the logger
|
|
9
|
+
* @returns A logger instance
|
|
10
|
+
*/
|
|
11
|
+
static create(config?: Partial<LoggerConfig>): ILogger;
|
|
12
|
+
/**
|
|
13
|
+
* Create a child logger with additional metadata.
|
|
14
|
+
* @param parent - The parent logger instance
|
|
15
|
+
* @param metadata - Additional metadata to include in all child log messages
|
|
16
|
+
* @returns A new logger instance with the additional metadata
|
|
17
|
+
*/
|
|
18
|
+
static createChild(parent: ILogger, metadata: Record<string, any>): ILogger;
|
|
19
|
+
private static mergeConfig;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Convenience function for creating a logger instance.
|
|
23
|
+
* @param config - Optional configuration for the logger
|
|
24
|
+
* @returns A logger instance appropriate for the current runtime
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* import { createLogger, LogLevel } from 'logan-logger';
|
|
28
|
+
*
|
|
29
|
+
* const logger = createLogger({
|
|
30
|
+
* level: LogLevel.DEBUG,
|
|
31
|
+
* colorize: true
|
|
32
|
+
* });
|
|
33
|
+
*
|
|
34
|
+
* logger.info('Hello world!');
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function createLogger(config?: Partial<LoggerConfig>): ILogger;
|
|
38
|
+
/**
|
|
39
|
+
* Create a logger with configuration based on the current environment.
|
|
40
|
+
* Automatically detects production/development/test environments and
|
|
41
|
+
* sets appropriate log levels and formatting.
|
|
42
|
+
* @returns A logger instance configured for the current environment
|
|
43
|
+
*/
|
|
44
|
+
export declare function createLoggerForEnvironment(): ILogger;
|
|
45
|
+
export declare function stringToLogLevel(level: string): LogLevel;
|
|
46
|
+
export declare function logLevelToString(level: LogLevel): string;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ILogger, LoggerConfig, LogLevel } from './types.mjs';
|
|
2
|
+
/**
|
|
3
|
+
* Factory class for creating logger instances based on the detected runtime.
|
|
4
|
+
*/
|
|
5
|
+
export declare class LoggerFactory {
|
|
6
|
+
/**
|
|
7
|
+
* Create a logger instance appropriate for the current runtime.
|
|
8
|
+
* @param config - Optional configuration for the logger
|
|
9
|
+
* @returns A logger instance
|
|
10
|
+
*/
|
|
11
|
+
static create(config?: Partial<LoggerConfig>): ILogger;
|
|
12
|
+
/**
|
|
13
|
+
* Create a child logger with additional metadata.
|
|
14
|
+
* @param parent - The parent logger instance
|
|
15
|
+
* @param metadata - Additional metadata to include in all child log messages
|
|
16
|
+
* @returns A new logger instance with the additional metadata
|
|
17
|
+
*/
|
|
18
|
+
static createChild(parent: ILogger, metadata: Record<string, any>): ILogger;
|
|
19
|
+
private static mergeConfig;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Convenience function for creating a logger instance.
|
|
23
|
+
* @param config - Optional configuration for the logger
|
|
24
|
+
* @returns A logger instance appropriate for the current runtime
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* import { createLogger, LogLevel } from 'logan-logger';
|
|
28
|
+
*
|
|
29
|
+
* const logger = createLogger({
|
|
30
|
+
* level: LogLevel.DEBUG,
|
|
31
|
+
* colorize: true
|
|
32
|
+
* });
|
|
33
|
+
*
|
|
34
|
+
* logger.info('Hello world!');
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function createLogger(config?: Partial<LoggerConfig>): ILogger;
|
|
38
|
+
/**
|
|
39
|
+
* Create a logger with configuration based on the current environment.
|
|
40
|
+
* Automatically detects production/development/test environments and
|
|
41
|
+
* sets appropriate log levels and formatting.
|
|
42
|
+
* @returns A logger instance configured for the current environment
|
|
43
|
+
*/
|
|
44
|
+
export declare function createLoggerForEnvironment(): ILogger;
|
|
45
|
+
export declare function stringToLogLevel(level: string): LogLevel;
|
|
46
|
+
export declare function logLevelToString(level: LogLevel): string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ILogger, LogEntry, LoggerConfig, LogLevel, LogMessage, RuntimeName } from './types.cjs';
|
|
2
|
+
export declare abstract class BaseLogger implements ILogger {
|
|
3
|
+
protected level: LogLevel;
|
|
4
|
+
protected config: Partial<LoggerConfig>;
|
|
5
|
+
protected runtime: RuntimeName;
|
|
6
|
+
protected childMetadata: Record<string, any>;
|
|
7
|
+
protected constructor(config?: Partial<LoggerConfig>);
|
|
8
|
+
debug(message: LogMessage, metadata?: any): void;
|
|
9
|
+
info(message: LogMessage, metadata?: any): void;
|
|
10
|
+
warn(message: LogMessage, metadata?: any): void;
|
|
11
|
+
error(message: LogMessage, metadata?: any): void;
|
|
12
|
+
log(level: LogLevel, message: LogMessage, metadata?: any): void;
|
|
13
|
+
setLevel(level: LogLevel): void;
|
|
14
|
+
getLevel(): LogLevel;
|
|
15
|
+
child(metadata: Record<string, any>): ILogger;
|
|
16
|
+
protected shouldLog(level: LogLevel): boolean;
|
|
17
|
+
protected abstract writeLog(entry: LogEntry): void;
|
|
18
|
+
protected abstract createChild(): BaseLogger;
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ILogger, LogEntry, LoggerConfig, LogLevel, LogMessage, RuntimeName } from './types.mjs';
|
|
2
|
+
export declare abstract class BaseLogger implements ILogger {
|
|
3
|
+
protected level: LogLevel;
|
|
4
|
+
protected config: Partial<LoggerConfig>;
|
|
5
|
+
protected runtime: RuntimeName;
|
|
6
|
+
protected childMetadata: Record<string, any>;
|
|
7
|
+
protected constructor(config?: Partial<LoggerConfig>);
|
|
8
|
+
debug(message: LogMessage, metadata?: any): void;
|
|
9
|
+
info(message: LogMessage, metadata?: any): void;
|
|
10
|
+
warn(message: LogMessage, metadata?: any): void;
|
|
11
|
+
error(message: LogMessage, metadata?: any): void;
|
|
12
|
+
log(level: LogLevel, message: LogMessage, metadata?: any): void;
|
|
13
|
+
setLevel(level: LogLevel): void;
|
|
14
|
+
getLevel(): LogLevel;
|
|
15
|
+
child(metadata: Record<string, any>): ILogger;
|
|
16
|
+
protected shouldLog(level: LogLevel): boolean;
|
|
17
|
+
protected abstract writeLog(entry: LogEntry): void;
|
|
18
|
+
protected abstract createChild(): BaseLogger;
|
|
19
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Log levels in ascending order of severity.
|
|
3
|
+
* Used to filter which messages should be logged.
|
|
4
|
+
*/
|
|
5
|
+
export declare enum LogLevel {
|
|
6
|
+
/** Debug messages - most verbose */
|
|
7
|
+
DEBUG = 0,
|
|
8
|
+
/** Informational messages */
|
|
9
|
+
INFO = 1,
|
|
10
|
+
/** Warning messages */
|
|
11
|
+
WARN = 2,
|
|
12
|
+
/** Error messages */
|
|
13
|
+
ERROR = 3,
|
|
14
|
+
/** No messages - silent mode */
|
|
15
|
+
SILENT = 4
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* String representation of log levels.
|
|
19
|
+
*/
|
|
20
|
+
export type LogLevelString = 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
21
|
+
/**
|
|
22
|
+
* Supported JavaScript runtime environments.
|
|
23
|
+
*/
|
|
24
|
+
export type RuntimeName = 'node' | 'deno' | 'bun' | 'browser' | 'webworker' | 'unknown';
|
|
25
|
+
/**
|
|
26
|
+
* Information about the detected JavaScript runtime environment.
|
|
27
|
+
*/
|
|
28
|
+
export interface RuntimeInfo {
|
|
29
|
+
/** The name of the runtime */
|
|
30
|
+
name: RuntimeName;
|
|
31
|
+
/** Version string of the runtime (if available) */
|
|
32
|
+
version?: string;
|
|
33
|
+
/** Capabilities supported by this runtime */
|
|
34
|
+
capabilities: RuntimeCapabilities;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Capabilities that a runtime may or may not support.
|
|
38
|
+
*/
|
|
39
|
+
export interface RuntimeCapabilities {
|
|
40
|
+
/** Whether the runtime supports file system operations */
|
|
41
|
+
fileSystem: boolean;
|
|
42
|
+
/** Whether the runtime supports colored console output */
|
|
43
|
+
colorSupport: boolean;
|
|
44
|
+
/** Whether the runtime provides process information */
|
|
45
|
+
processInfo: boolean;
|
|
46
|
+
/** Whether the runtime supports streams */
|
|
47
|
+
streams: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Configuration options for creating a logger instance.
|
|
51
|
+
*/
|
|
52
|
+
export interface LoggerConfig {
|
|
53
|
+
/** Minimum log level to output */
|
|
54
|
+
level: LogLevel;
|
|
55
|
+
/** Output format for log messages */
|
|
56
|
+
format: 'json' | 'text' | 'custom';
|
|
57
|
+
/** Whether to include timestamps in log output */
|
|
58
|
+
timestamp: boolean;
|
|
59
|
+
/** Whether to colorize log output (if supported) */
|
|
60
|
+
colorize: boolean;
|
|
61
|
+
/** Default metadata to include with all log messages */
|
|
62
|
+
metadata: Record<string, any>;
|
|
63
|
+
/** Transport configurations for log output */
|
|
64
|
+
transports?: TransportConfig[];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Configuration for a specific log transport (output destination).
|
|
68
|
+
*/
|
|
69
|
+
export interface TransportConfig {
|
|
70
|
+
/** Type of transport */
|
|
71
|
+
type: 'console' | 'file' | 'http' | 'custom';
|
|
72
|
+
/** Minimum log level for this transport */
|
|
73
|
+
level?: LogLevel;
|
|
74
|
+
/** Transport-specific options */
|
|
75
|
+
options: Record<string, any>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A log message can be a string or a function that returns a string.
|
|
79
|
+
* Functions enable lazy evaluation for expensive log message generation.
|
|
80
|
+
*/
|
|
81
|
+
export type LogMessage = string | (() => string);
|
|
82
|
+
/**
|
|
83
|
+
* Internal representation of a log entry.
|
|
84
|
+
*/
|
|
85
|
+
export interface LogEntry {
|
|
86
|
+
/** When the log entry was created */
|
|
87
|
+
timestamp: Date;
|
|
88
|
+
/** Log level of this entry */
|
|
89
|
+
level: LogLevel;
|
|
90
|
+
/** The log message */
|
|
91
|
+
message: string;
|
|
92
|
+
/** Additional structured data */
|
|
93
|
+
metadata?: Record<string, any>;
|
|
94
|
+
/** Runtime that generated this log entry */
|
|
95
|
+
runtime: RuntimeName;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Main logger interface providing methods for logging at different levels.
|
|
99
|
+
* This interface is implemented by all logger implementations across different runtimes.
|
|
100
|
+
*/
|
|
101
|
+
export interface ILogger {
|
|
102
|
+
/**
|
|
103
|
+
* Log a debug message. Only shown when log level is DEBUG.
|
|
104
|
+
* @param message - The message to log (string or lazy function)
|
|
105
|
+
* @param metadata - Optional structured data to include
|
|
106
|
+
*/
|
|
107
|
+
debug(message: LogMessage, metadata?: any): void;
|
|
108
|
+
/**
|
|
109
|
+
* Log an informational message.
|
|
110
|
+
* @param message - The message to log (string or lazy function)
|
|
111
|
+
* @param metadata - Optional structured data to include
|
|
112
|
+
*/
|
|
113
|
+
info(message: LogMessage, metadata?: any): void;
|
|
114
|
+
/**
|
|
115
|
+
* Log a warning message.
|
|
116
|
+
* @param message - The message to log (string or lazy function)
|
|
117
|
+
* @param metadata - Optional structured data to include
|
|
118
|
+
*/
|
|
119
|
+
warn(message: LogMessage, metadata?: any): void;
|
|
120
|
+
/**
|
|
121
|
+
* Log an error message.
|
|
122
|
+
* @param message - The message to log (string or lazy function)
|
|
123
|
+
* @param metadata - Optional structured data to include
|
|
124
|
+
*/
|
|
125
|
+
error(message: LogMessage, metadata?: any): void;
|
|
126
|
+
/**
|
|
127
|
+
* Log a message at a specific level.
|
|
128
|
+
* @param level - The log level
|
|
129
|
+
* @param message - The message to log (string or lazy function)
|
|
130
|
+
* @param metadata - Optional structured data to include
|
|
131
|
+
*/
|
|
132
|
+
log(level: LogLevel, message: LogMessage, metadata?: any): void;
|
|
133
|
+
/**
|
|
134
|
+
* Set the minimum log level for this logger.
|
|
135
|
+
* @param level - The minimum log level
|
|
136
|
+
*/
|
|
137
|
+
setLevel(level: LogLevel): void;
|
|
138
|
+
/**
|
|
139
|
+
* Get the current minimum log level.
|
|
140
|
+
* @returns The current log level
|
|
141
|
+
*/
|
|
142
|
+
getLevel(): LogLevel;
|
|
143
|
+
/**
|
|
144
|
+
* Create a child logger with additional metadata.
|
|
145
|
+
* @param metadata - Additional metadata to include in all child log messages
|
|
146
|
+
* @returns A new logger instance with the additional metadata
|
|
147
|
+
*/
|
|
148
|
+
child(metadata: Record<string, any>): ILogger;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Interface for logger adapters that handle the actual log output.
|
|
152
|
+
* This abstraction allows different implementations for different runtimes.
|
|
153
|
+
*/
|
|
154
|
+
export interface ILoggerAdapter {
|
|
155
|
+
/**
|
|
156
|
+
* Write a log entry to the output destination.
|
|
157
|
+
* @param entry - The log entry to write
|
|
158
|
+
*/
|
|
159
|
+
log(entry: LogEntry): void;
|
|
160
|
+
/**
|
|
161
|
+
* Set the minimum log level for this adapter.
|
|
162
|
+
* @param level - The minimum log level
|
|
163
|
+
*/
|
|
164
|
+
setLevel(level: LogLevel): void;
|
|
165
|
+
/**
|
|
166
|
+
* Get the current minimum log level.
|
|
167
|
+
* @returns The current log level
|
|
168
|
+
*/
|
|
169
|
+
getLevel(): LogLevel;
|
|
170
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Log levels in ascending order of severity.
|
|
3
|
+
* Used to filter which messages should be logged.
|
|
4
|
+
*/
|
|
5
|
+
export declare enum LogLevel {
|
|
6
|
+
/** Debug messages - most verbose */
|
|
7
|
+
DEBUG = 0,
|
|
8
|
+
/** Informational messages */
|
|
9
|
+
INFO = 1,
|
|
10
|
+
/** Warning messages */
|
|
11
|
+
WARN = 2,
|
|
12
|
+
/** Error messages */
|
|
13
|
+
ERROR = 3,
|
|
14
|
+
/** No messages - silent mode */
|
|
15
|
+
SILENT = 4
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* String representation of log levels.
|
|
19
|
+
*/
|
|
20
|
+
export type LogLevelString = 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
21
|
+
/**
|
|
22
|
+
* Supported JavaScript runtime environments.
|
|
23
|
+
*/
|
|
24
|
+
export type RuntimeName = 'node' | 'deno' | 'bun' | 'browser' | 'webworker' | 'unknown';
|
|
25
|
+
/**
|
|
26
|
+
* Information about the detected JavaScript runtime environment.
|
|
27
|
+
*/
|
|
28
|
+
export interface RuntimeInfo {
|
|
29
|
+
/** The name of the runtime */
|
|
30
|
+
name: RuntimeName;
|
|
31
|
+
/** Version string of the runtime (if available) */
|
|
32
|
+
version?: string;
|
|
33
|
+
/** Capabilities supported by this runtime */
|
|
34
|
+
capabilities: RuntimeCapabilities;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Capabilities that a runtime may or may not support.
|
|
38
|
+
*/
|
|
39
|
+
export interface RuntimeCapabilities {
|
|
40
|
+
/** Whether the runtime supports file system operations */
|
|
41
|
+
fileSystem: boolean;
|
|
42
|
+
/** Whether the runtime supports colored console output */
|
|
43
|
+
colorSupport: boolean;
|
|
44
|
+
/** Whether the runtime provides process information */
|
|
45
|
+
processInfo: boolean;
|
|
46
|
+
/** Whether the runtime supports streams */
|
|
47
|
+
streams: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Configuration options for creating a logger instance.
|
|
51
|
+
*/
|
|
52
|
+
export interface LoggerConfig {
|
|
53
|
+
/** Minimum log level to output */
|
|
54
|
+
level: LogLevel;
|
|
55
|
+
/** Output format for log messages */
|
|
56
|
+
format: 'json' | 'text' | 'custom';
|
|
57
|
+
/** Whether to include timestamps in log output */
|
|
58
|
+
timestamp: boolean;
|
|
59
|
+
/** Whether to colorize log output (if supported) */
|
|
60
|
+
colorize: boolean;
|
|
61
|
+
/** Default metadata to include with all log messages */
|
|
62
|
+
metadata: Record<string, any>;
|
|
63
|
+
/** Transport configurations for log output */
|
|
64
|
+
transports?: TransportConfig[];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Configuration for a specific log transport (output destination).
|
|
68
|
+
*/
|
|
69
|
+
export interface TransportConfig {
|
|
70
|
+
/** Type of transport */
|
|
71
|
+
type: 'console' | 'file' | 'http' | 'custom';
|
|
72
|
+
/** Minimum log level for this transport */
|
|
73
|
+
level?: LogLevel;
|
|
74
|
+
/** Transport-specific options */
|
|
75
|
+
options: Record<string, any>;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A log message can be a string or a function that returns a string.
|
|
79
|
+
* Functions enable lazy evaluation for expensive log message generation.
|
|
80
|
+
*/
|
|
81
|
+
export type LogMessage = string | (() => string);
|
|
82
|
+
/**
|
|
83
|
+
* Internal representation of a log entry.
|
|
84
|
+
*/
|
|
85
|
+
export interface LogEntry {
|
|
86
|
+
/** When the log entry was created */
|
|
87
|
+
timestamp: Date;
|
|
88
|
+
/** Log level of this entry */
|
|
89
|
+
level: LogLevel;
|
|
90
|
+
/** The log message */
|
|
91
|
+
message: string;
|
|
92
|
+
/** Additional structured data */
|
|
93
|
+
metadata?: Record<string, any>;
|
|
94
|
+
/** Runtime that generated this log entry */
|
|
95
|
+
runtime: RuntimeName;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Main logger interface providing methods for logging at different levels.
|
|
99
|
+
* This interface is implemented by all logger implementations across different runtimes.
|
|
100
|
+
*/
|
|
101
|
+
export interface ILogger {
|
|
102
|
+
/**
|
|
103
|
+
* Log a debug message. Only shown when log level is DEBUG.
|
|
104
|
+
* @param message - The message to log (string or lazy function)
|
|
105
|
+
* @param metadata - Optional structured data to include
|
|
106
|
+
*/
|
|
107
|
+
debug(message: LogMessage, metadata?: any): void;
|
|
108
|
+
/**
|
|
109
|
+
* Log an informational message.
|
|
110
|
+
* @param message - The message to log (string or lazy function)
|
|
111
|
+
* @param metadata - Optional structured data to include
|
|
112
|
+
*/
|
|
113
|
+
info(message: LogMessage, metadata?: any): void;
|
|
114
|
+
/**
|
|
115
|
+
* Log a warning message.
|
|
116
|
+
* @param message - The message to log (string or lazy function)
|
|
117
|
+
* @param metadata - Optional structured data to include
|
|
118
|
+
*/
|
|
119
|
+
warn(message: LogMessage, metadata?: any): void;
|
|
120
|
+
/**
|
|
121
|
+
* Log an error message.
|
|
122
|
+
* @param message - The message to log (string or lazy function)
|
|
123
|
+
* @param metadata - Optional structured data to include
|
|
124
|
+
*/
|
|
125
|
+
error(message: LogMessage, metadata?: any): void;
|
|
126
|
+
/**
|
|
127
|
+
* Log a message at a specific level.
|
|
128
|
+
* @param level - The log level
|
|
129
|
+
* @param message - The message to log (string or lazy function)
|
|
130
|
+
* @param metadata - Optional structured data to include
|
|
131
|
+
*/
|
|
132
|
+
log(level: LogLevel, message: LogMessage, metadata?: any): void;
|
|
133
|
+
/**
|
|
134
|
+
* Set the minimum log level for this logger.
|
|
135
|
+
* @param level - The minimum log level
|
|
136
|
+
*/
|
|
137
|
+
setLevel(level: LogLevel): void;
|
|
138
|
+
/**
|
|
139
|
+
* Get the current minimum log level.
|
|
140
|
+
* @returns The current log level
|
|
141
|
+
*/
|
|
142
|
+
getLevel(): LogLevel;
|
|
143
|
+
/**
|
|
144
|
+
* Create a child logger with additional metadata.
|
|
145
|
+
* @param metadata - Additional metadata to include in all child log messages
|
|
146
|
+
* @returns A new logger instance with the additional metadata
|
|
147
|
+
*/
|
|
148
|
+
child(metadata: Record<string, any>): ILogger;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Interface for logger adapters that handle the actual log output.
|
|
152
|
+
* This abstraction allows different implementations for different runtimes.
|
|
153
|
+
*/
|
|
154
|
+
export interface ILoggerAdapter {
|
|
155
|
+
/**
|
|
156
|
+
* Write a log entry to the output destination.
|
|
157
|
+
* @param entry - The log entry to write
|
|
158
|
+
*/
|
|
159
|
+
log(entry: LogEntry): void;
|
|
160
|
+
/**
|
|
161
|
+
* Set the minimum log level for this adapter.
|
|
162
|
+
* @param level - The minimum log level
|
|
163
|
+
*/
|
|
164
|
+
setLevel(level: LogLevel): void;
|
|
165
|
+
/**
|
|
166
|
+
* Get the current minimum log level.
|
|
167
|
+
* @returns The current log level
|
|
168
|
+
*/
|
|
169
|
+
getLevel(): LogLevel;
|
|
170
|
+
}
|
package/dist/deno.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./chunks/factory-B8mZAA08.cjs"),t=require("./chunks/browser-D9bA4EUQ.cjs"),n=require("./chunks/formatting-D6Y8pN18.cjs");exports.BrowserLogger=t.t,exports.ConsoleGroupLogger=t.n,exports.PerformanceLogger=t.r,exports.createLogger=e.n,exports.createLoggerForEnvironment=e.r,exports.detectRuntime=t.l,exports.filterSensitiveData=t.i,exports.formatLevel=n.t,exports.formatLogEntry=n.n,exports.getDefaultConfig=e.o,exports.isBrowser=t.u,exports.isBun=t.d,exports.isDeno=t.f,exports.isNode=t.p,exports.loadConfigFromEnvironment=e.s,exports.loadConfigFromFile=e.c,exports.mergeConfigs=e.l,exports.safeStringify=t.a,exports.serializeError=t.o;
|
package/dist/deno.d.cts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createLogger, createLoggerForEnvironment } from './core/factory.cjs';
|
|
2
|
+
export type { ILogger, LoggerConfig, LogLevel } from './core/types.cjs';
|
|
3
|
+
export { BrowserLogger, ConsoleGroupLogger, PerformanceLogger } from './runtime/browser.cjs';
|
|
4
|
+
export * from './utils/config.cjs';
|
|
5
|
+
export * from './utils/formatting.cjs';
|
|
6
|
+
export * from './utils/runtime.cjs';
|
|
7
|
+
export * from './utils/serialization.cjs';
|
package/dist/deno.d.mts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { createLogger, createLoggerForEnvironment } from './core/factory.mjs';
|
|
2
|
+
export type { ILogger, LoggerConfig, LogLevel } from './core/types.mjs';
|
|
3
|
+
export { BrowserLogger, ConsoleGroupLogger, PerformanceLogger } from './runtime/browser.mjs';
|
|
4
|
+
export * from './utils/config.mjs';
|
|
5
|
+
export * from './utils/formatting.mjs';
|
|
6
|
+
export * from './utils/runtime.mjs';
|
|
7
|
+
export * from './utils/serialization.mjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as e, l as t, n, o as r, r as i, s as a } from "./factory-CG8zWIqv.mjs";
|
|
2
|
-
import { a as o, d as s, f as c, i as l, l as u, n as d, o as f, p, r as m, t as h, u as g } from "./browser-DV_BQqDK.mjs";
|
|
3
|
-
import { n as _, t as v } from "./formatting-DP_57uSR.mjs";
|
|
1
|
+
import { c as e, l as t, n, o as r, r as i, s as a } from "./chunks/factory-CG8zWIqv.mjs";
|
|
2
|
+
import { a as o, d as s, f as c, i as l, l as u, n as d, o as f, p, r as m, t as h, u as g } from "./chunks/browser-DV_BQqDK.mjs";
|
|
3
|
+
import { n as _, t as v } from "./chunks/formatting-DP_57uSR.mjs";
|
|
4
4
|
export { h as BrowserLogger, d as ConsoleGroupLogger, m as PerformanceLogger, n as createLogger, i as createLoggerForEnvironment, u as detectRuntime, l as filterSensitiveData, v as formatLevel, _ as formatLogEntry, r as getDefaultConfig, g as isBrowser, s as isBun, c as isDeno, p as isNode, a as loadConfigFromEnvironment, e as loadConfigFromFile, t as mergeConfigs, o as safeStringify, f as serializeError };
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./chunks/factory-B8mZAA08.cjs"),t=require("./chunks/browser-D9bA4EUQ.cjs"),n=require("./chunks/formatting-D6Y8pN18.cjs");var r=e.r(),i={debug:(e,t)=>r.debug(e,t),info:(e,t)=>r.info(e,t),warn:(e,t)=>r.warn(e,t),error:(e,t)=>r.error(e,t)};exports.BaseLogger=t.s,exports.BrowserLogger=t.t,exports.ConsoleGroupLogger=t.n,exports.LogLevel=t.c,exports.LoggerFactory=e.t,exports.PerformanceLogger=t.r,exports.createLogger=e.n,exports.createLoggerForEnvironment=e.r,exports.detectRuntime=t.l,exports.filterSensitiveData=t.i,exports.formatLevel=n.t,exports.formatLogEntry=n.n,exports.getDefaultConfig=e.o,exports.isBrowser=t.u,exports.isBun=t.d,exports.isDeno=t.f,exports.isNode=t.p,exports.loadConfigFromEnvironment=e.s,exports.loadConfigFromFile=e.c,exports.log=i,exports.logLevelToString=e.i,exports.logger=r,exports.mergeConfigs=e.l,exports.safeStringify=t.a,exports.serializeError=t.o,exports.stringToLogLevel=e.a;
|