@mcp-shark/mcp-shark 1.5.0 → 1.5.2

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/shared/logger.js +90 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-shark/mcp-shark",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "Aggregate multiple Model Context Protocol (MCP) servers into a single unified interface with a powerful monitoring UI. Prov deep visibility into every request and response.",
5
5
  "type": "module",
6
6
  "main": "./bin/mcp-shark.js",
@@ -20,7 +20,7 @@
20
20
  "bugs": {
21
21
  "url": "https://github.com/mcp-shark/mcp-shark/issues"
22
22
  },
23
- "files": ["bin", "ui", "mcp-server", "README.md", "LICENSE", "package.json"],
23
+ "files": ["bin", "ui", "mcp-server", "shared", "README.md", "LICENSE", "package.json"],
24
24
  "scripts": {
25
25
  "start": "node scripts/start-ui.js",
26
26
  "predev": "npm run build:ui",
@@ -0,0 +1,90 @@
1
+ import { consola } from 'consola';
2
+
3
+ /**
4
+ * Unified logger for the entire codebase
5
+ * Uses consola (already installed) with a consistent API
6
+ * Supports both Pino-style API (object, message) and consola-style (multiple args)
7
+ */
8
+ const logger = {
9
+ info: (...args) => {
10
+ if (args.length === 0) {
11
+ return;
12
+ }
13
+ // If first arg is an object and second is a string, use Pino-style
14
+ if (
15
+ args.length === 2 &&
16
+ typeof args[0] === 'object' &&
17
+ args[0] !== null &&
18
+ typeof args[1] === 'string'
19
+ ) {
20
+ consola.info(args[1] || '', args[0]);
21
+ } else {
22
+ // Otherwise, pass all args to consola (supports multiple strings/values)
23
+ consola.info(...args);
24
+ }
25
+ },
26
+ error: (...args) => {
27
+ if (args.length === 0) {
28
+ return;
29
+ }
30
+ if (
31
+ args.length === 2 &&
32
+ typeof args[0] === 'object' &&
33
+ args[0] !== null &&
34
+ typeof args[1] === 'string'
35
+ ) {
36
+ consola.error(args[1] || '', args[0]);
37
+ } else {
38
+ consola.error(...args);
39
+ }
40
+ },
41
+ warn: (...args) => {
42
+ if (args.length === 0) {
43
+ return;
44
+ }
45
+ if (
46
+ args.length === 2 &&
47
+ typeof args[0] === 'object' &&
48
+ args[0] !== null &&
49
+ typeof args[1] === 'string'
50
+ ) {
51
+ consola.warn(args[1] || '', args[0]);
52
+ } else {
53
+ consola.warn(...args);
54
+ }
55
+ },
56
+ debug: (...args) => {
57
+ if (args.length === 0) {
58
+ return;
59
+ }
60
+ if (
61
+ args.length === 2 &&
62
+ typeof args[0] === 'object' &&
63
+ args[0] !== null &&
64
+ typeof args[1] === 'string'
65
+ ) {
66
+ consola.debug(args[1] || '', args[0]);
67
+ } else {
68
+ consola.debug(...args);
69
+ }
70
+ },
71
+ log: (...args) => {
72
+ if (args.length === 0) {
73
+ return;
74
+ }
75
+ if (
76
+ args.length === 2 &&
77
+ typeof args[0] === 'object' &&
78
+ args[0] !== null &&
79
+ typeof args[1] === 'string'
80
+ ) {
81
+ consola.log(args[1] || '', args[0]);
82
+ } else {
83
+ consola.log(...args);
84
+ }
85
+ },
86
+ // Expose consola directly for advanced usage
87
+ consola,
88
+ };
89
+
90
+ export default logger;