@abbacchio/browser-transport 0.1.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/dist/logger.js ADDED
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Logger class for Abbacchio
3
+ * Provides a structured logging API similar to Pino
4
+ */
5
+ import { AbbacchioClient } from './client.js';
6
+ // Log level numbers (Pino compatible)
7
+ export const LOG_LEVELS = {
8
+ trace: 10,
9
+ debug: 20,
10
+ info: 30,
11
+ warn: 40,
12
+ error: 50,
13
+ fatal: 60,
14
+ };
15
+ /**
16
+ * Browser logger for Abbacchio
17
+ * Provides structured logging with automatic batching and optional encryption
18
+ */
19
+ export class Logger {
20
+ constructor(options = {}) {
21
+ this.bindings = {};
22
+ this.client = new AbbacchioClient(options);
23
+ this.name = options.name || 'app';
24
+ this.minLevel = this.parseLevel(options.level || 'debug');
25
+ this.includeUrl = options.includeUrl ?? false;
26
+ }
27
+ /**
28
+ * Parse level string or number to numeric level
29
+ */
30
+ parseLevel(level) {
31
+ if (typeof level === 'number')
32
+ return level;
33
+ return LOG_LEVELS[level] ?? LOG_LEVELS.info;
34
+ }
35
+ /**
36
+ * Create a log entry
37
+ */
38
+ createEntry(level, msg, data) {
39
+ const entry = {
40
+ level,
41
+ time: Date.now(),
42
+ name: this.name,
43
+ msg,
44
+ ...this.bindings,
45
+ ...data,
46
+ };
47
+ if (this.includeUrl && typeof window !== 'undefined') {
48
+ entry.url = window.location.href;
49
+ }
50
+ return entry;
51
+ }
52
+ /**
53
+ * Internal log method
54
+ */
55
+ log(level, msgOrData, dataOrMsg) {
56
+ if (level < this.minLevel)
57
+ return;
58
+ let msg;
59
+ let data;
60
+ // Handle different call signatures:
61
+ // log(level, 'message')
62
+ // log(level, 'message', { data })
63
+ // log(level, { data }, 'message')
64
+ if (typeof msgOrData === 'string') {
65
+ msg = msgOrData;
66
+ data = typeof dataOrMsg === 'object' ? dataOrMsg : undefined;
67
+ }
68
+ else {
69
+ data = msgOrData;
70
+ msg = typeof dataOrMsg === 'string' ? dataOrMsg : '';
71
+ }
72
+ const entry = this.createEntry(level, msg, data);
73
+ this.client.add(entry);
74
+ }
75
+ trace(msgOrData, dataOrMsg) {
76
+ this.log(LOG_LEVELS.trace, msgOrData, dataOrMsg);
77
+ }
78
+ debug(msgOrData, dataOrMsg) {
79
+ this.log(LOG_LEVELS.debug, msgOrData, dataOrMsg);
80
+ }
81
+ info(msgOrData, dataOrMsg) {
82
+ this.log(LOG_LEVELS.info, msgOrData, dataOrMsg);
83
+ }
84
+ warn(msgOrData, dataOrMsg) {
85
+ this.log(LOG_LEVELS.warn, msgOrData, dataOrMsg);
86
+ }
87
+ error(msgOrData, dataOrMsg) {
88
+ this.log(LOG_LEVELS.error, msgOrData, dataOrMsg);
89
+ }
90
+ fatal(msgOrData, dataOrMsg) {
91
+ this.log(LOG_LEVELS.fatal, msgOrData, dataOrMsg);
92
+ }
93
+ /**
94
+ * Create a child logger with additional bindings
95
+ */
96
+ child(bindings) {
97
+ const child = Object.create(this);
98
+ child.bindings = { ...this.bindings, ...bindings };
99
+ return child;
100
+ }
101
+ /**
102
+ * Flush buffered logs
103
+ */
104
+ async flush() {
105
+ await this.client.flush();
106
+ }
107
+ /**
108
+ * Close the logger and flush remaining logs
109
+ */
110
+ async close() {
111
+ await this.client.close();
112
+ }
113
+ /**
114
+ * Set the minimum log level
115
+ */
116
+ setLevel(level) {
117
+ this.minLevel = this.parseLevel(level);
118
+ }
119
+ }
120
+ /**
121
+ * Create a new logger instance
122
+ */
123
+ export function createLogger(options) {
124
+ return new Logger(options);
125
+ }
126
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAA8C,MAAM,aAAa,CAAC;AAW1F,sCAAsC;AACtC,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,KAA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;QAC7F,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IACnD,CAAC;IAOD,KAAK,CAAC,SAA2C,EAAE,SAA4C;QAC7F,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAiC;QACrC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAW,CAAC;QAC5C,KAAK,CAAC,QAAQ,GAAG,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,GAAG,QAAQ,EAAE,CAAC;QACnD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,KAAwB;QAC/B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,OAAuB;IAClD,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * React Context Provider for Abbacchio
3
+ * Provides logging functionality to React components via context
4
+ */
5
+ import { type ReactNode } from 'react';
6
+ import { Logger, type LoggerOptions } from '../logger.js';
7
+ import { type ConsoleInterceptorOptions } from '../console.js';
8
+ export interface AbbacchioContextValue {
9
+ /** Logger instance for structured logging */
10
+ logger: Logger;
11
+ /** Log at info level */
12
+ info: Logger['info'];
13
+ /** Log at warn level */
14
+ warn: Logger['warn'];
15
+ /** Log at error level */
16
+ error: Logger['error'];
17
+ /** Log at debug level */
18
+ debug: Logger['debug'];
19
+ /** Create a child logger with additional bindings */
20
+ child: Logger['child'];
21
+ }
22
+ export interface AbbacchioProviderProps extends LoggerOptions {
23
+ children: ReactNode;
24
+ /** Whether to intercept console.log/warn/error/etc. Defaults to false */
25
+ captureConsole?: boolean;
26
+ /** Options for console capture (only used if captureConsole is true) */
27
+ consoleOptions?: Omit<ConsoleInterceptorOptions, keyof LoggerOptions>;
28
+ }
29
+ /**
30
+ * Provider component that makes logging available to all child components
31
+ *
32
+ * @example
33
+ * ```tsx
34
+ * function App() {
35
+ * return (
36
+ * <AbbacchioProvider
37
+ * url="http://localhost:4000/api/logs"
38
+ * channel="my-react-app"
39
+ * captureConsole
40
+ * >
41
+ * <MyApp />
42
+ * </AbbacchioProvider>
43
+ * )
44
+ * }
45
+ * ```
46
+ */
47
+ export declare function AbbacchioProvider({ children, captureConsole, consoleOptions, ...loggerOptions }: AbbacchioProviderProps): import("react/jsx-runtime").JSX.Element;
48
+ /**
49
+ * Hook to access the Abbacchio logger from any component
50
+ *
51
+ * @example
52
+ * ```tsx
53
+ * function MyComponent() {
54
+ * const { info, error } = useAbbacchio()
55
+ *
56
+ * const handleClick = () => {
57
+ * info('Button clicked', { component: 'MyComponent' })
58
+ * }
59
+ *
60
+ * return <button onClick={handleClick}>Click me</button>
61
+ * }
62
+ * ```
63
+ */
64
+ export declare function useAbbacchio(): AbbacchioContextValue;
65
+ /**
66
+ * Hook to get just the logger instance
67
+ *
68
+ * @example
69
+ * ```tsx
70
+ * function MyComponent() {
71
+ * const log = useLogger()
72
+ *
73
+ * useEffect(() => {
74
+ * log.info('Component mounted')
75
+ * return () => log.info('Component unmounted')
76
+ * }, [log])
77
+ *
78
+ * return <div>Hello</div>
79
+ * }
80
+ * ```
81
+ */
82
+ export declare function useLogger(): Logger;
83
+ //# sourceMappingURL=AbbacchioProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AbbacchioProvider.d.ts","sourceRoot":"","sources":["../../src/react/AbbacchioProvider.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAiD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACtF,OAAO,EAAE,MAAM,EAAgB,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAA0C,KAAK,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAEvG,MAAM,WAAW,qBAAqB;IACpC,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IACrB,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IACrB,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IACvB,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IACvB,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;CACxB;AAID,MAAM,WAAW,sBAAuB,SAAQ,aAAa;IAC3D,QAAQ,EAAE,SAAS,CAAC;IACpB,yEAAyE;IACzE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,wEAAwE;IACxE,cAAc,CAAC,EAAE,IAAI,CAAC,yBAAyB,EAAE,MAAM,aAAa,CAAC,CAAC;CACvE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,cAAsB,EACtB,cAAc,EACd,GAAG,aAAa,EACjB,EAAE,sBAAsB,2CAiDxB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,IAAI,qBAAqB,CAMpD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAGlC"}
@@ -0,0 +1,113 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * React Context Provider for Abbacchio
4
+ * Provides logging functionality to React components via context
5
+ */
6
+ import { createContext, useContext, useEffect, useMemo } from 'react';
7
+ import { createLogger } from '../logger.js';
8
+ import { interceptConsole, stopInterceptConsole } from '../console.js';
9
+ const AbbacchioContext = createContext(null);
10
+ /**
11
+ * Provider component that makes logging available to all child components
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * function App() {
16
+ * return (
17
+ * <AbbacchioProvider
18
+ * url="http://localhost:4000/api/logs"
19
+ * channel="my-react-app"
20
+ * captureConsole
21
+ * >
22
+ * <MyApp />
23
+ * </AbbacchioProvider>
24
+ * )
25
+ * }
26
+ * ```
27
+ */
28
+ export function AbbacchioProvider({ children, captureConsole = false, consoleOptions, ...loggerOptions }) {
29
+ // Create logger instance
30
+ const logger = useMemo(() => createLogger(loggerOptions), [
31
+ loggerOptions.url,
32
+ loggerOptions.channel,
33
+ loggerOptions.secretKey,
34
+ loggerOptions.name,
35
+ loggerOptions.level,
36
+ loggerOptions.batchSize,
37
+ loggerOptions.flushInterval,
38
+ ]);
39
+ // Setup console interception if enabled
40
+ useEffect(() => {
41
+ if (captureConsole) {
42
+ interceptConsole({
43
+ ...loggerOptions,
44
+ ...consoleOptions,
45
+ appName: consoleOptions?.appName || loggerOptions.name,
46
+ });
47
+ return () => {
48
+ stopInterceptConsole();
49
+ };
50
+ }
51
+ }, [captureConsole, loggerOptions, consoleOptions]);
52
+ // Cleanup on unmount
53
+ useEffect(() => {
54
+ return () => {
55
+ logger.close();
56
+ };
57
+ }, [logger]);
58
+ // Create context value with bound methods
59
+ const value = useMemo(() => ({
60
+ logger,
61
+ info: logger.info.bind(logger),
62
+ warn: logger.warn.bind(logger),
63
+ error: logger.error.bind(logger),
64
+ debug: logger.debug.bind(logger),
65
+ child: logger.child.bind(logger),
66
+ }), [logger]);
67
+ return (_jsx(AbbacchioContext.Provider, { value: value, children: children }));
68
+ }
69
+ /**
70
+ * Hook to access the Abbacchio logger from any component
71
+ *
72
+ * @example
73
+ * ```tsx
74
+ * function MyComponent() {
75
+ * const { info, error } = useAbbacchio()
76
+ *
77
+ * const handleClick = () => {
78
+ * info('Button clicked', { component: 'MyComponent' })
79
+ * }
80
+ *
81
+ * return <button onClick={handleClick}>Click me</button>
82
+ * }
83
+ * ```
84
+ */
85
+ export function useAbbacchio() {
86
+ const context = useContext(AbbacchioContext);
87
+ if (!context) {
88
+ throw new Error('useAbbacchio must be used within an AbbacchioProvider');
89
+ }
90
+ return context;
91
+ }
92
+ /**
93
+ * Hook to get just the logger instance
94
+ *
95
+ * @example
96
+ * ```tsx
97
+ * function MyComponent() {
98
+ * const log = useLogger()
99
+ *
100
+ * useEffect(() => {
101
+ * log.info('Component mounted')
102
+ * return () => log.info('Component unmounted')
103
+ * }, [log])
104
+ *
105
+ * return <div>Hello</div>
106
+ * }
107
+ * ```
108
+ */
109
+ export function useLogger() {
110
+ const { logger } = useAbbacchio();
111
+ return logger;
112
+ }
113
+ //# sourceMappingURL=AbbacchioProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AbbacchioProvider.js","sourceRoot":"","sources":["../../src/react/AbbacchioProvider.tsx"],"names":[],"mappings":";AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAkB,MAAM,OAAO,CAAC;AACtF,OAAO,EAAU,YAAY,EAAsB,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAkC,MAAM,eAAe,CAAC;AAiBvG,MAAM,gBAAgB,GAAG,aAAa,CAA+B,IAAI,CAAC,CAAC;AAU3E;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAChC,QAAQ,EACR,cAAc,GAAG,KAAK,EACtB,cAAc,EACd,GAAG,aAAa,EACO;IACvB,yBAAyB;IACzB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,aAAa,CAAC,EAAE;QACxD,aAAa,CAAC,GAAG;QACjB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C,QAAQ,GACiB,CAC7B,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,YAAY;IAC1B,MAAM,OAAO,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAC;IAC7C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,SAAS;IACvB,MAAM,EAAE,MAAM,EAAE,GAAG,YAAY,EAAE,CAAC;IAClC,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * React bindings for Abbacchio browser transport
3
+ */
4
+ export { AbbacchioProvider, useAbbacchio, useLogger, type AbbacchioProviderProps, type AbbacchioContextValue, } from './AbbacchioProvider.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,GAC3B,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * React bindings for Abbacchio browser transport
3
+ */
4
+ export { AbbacchioProvider, useAbbacchio, useLogger, } from './AbbacchioProvider.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,SAAS,GAGV,MAAM,wBAAwB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@abbacchio/browser-transport",
3
+ "version": "0.1.0",
4
+ "description": "Browser and React logging client for Abbacchio - intercept console.log and send to your log viewer",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ },
14
+ "./react": {
15
+ "types": "./dist/react/index.d.ts",
16
+ "import": "./dist/react/index.js"
17
+ },
18
+ "./auto": {
19
+ "types": "./dist/auto.d.ts",
20
+ "import": "./dist/auto.js"
21
+ }
22
+ },
23
+ "files": [
24
+ "dist",
25
+ "README.md"
26
+ ],
27
+ "scripts": {
28
+ "build": "tsc",
29
+ "dev": "tsc --watch",
30
+ "clean": "rimraf dist",
31
+ "prepublishOnly": "npm run build"
32
+ },
33
+ "keywords": [
34
+ "logging",
35
+ "console",
36
+ "browser",
37
+ "react",
38
+ "pino",
39
+ "abbacchio",
40
+ "log-viewer",
41
+ "debugging"
42
+ ],
43
+ "author": "",
44
+ "license": "MIT",
45
+ "peerDependencies": {
46
+ "react": ">=17.0.0"
47
+ },
48
+ "peerDependenciesMeta": {
49
+ "react": {
50
+ "optional": true
51
+ }
52
+ },
53
+ "devDependencies": {
54
+ "@types/react": "^18.2.0",
55
+ "react": "^18.2.0",
56
+ "rimraf": "^5.0.0",
57
+ "typescript": "^5.0.0"
58
+ },
59
+ "repository": {
60
+ "type": "git",
61
+ "url": "https://github.com/your-org/abbacchio",
62
+ "directory": "packages/browser-transport"
63
+ }
64
+ }