• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

yiming-liao / logry / 15847159054

24 Jun 2025 09:49AM UTC coverage: 96.514% (-0.2%) from 96.733%
15847159054

push

github

yiming-liao
refactor(core): restructure logger pipeline and unify formatter

- Moved normalization and formatting steps from Logger to Transporters, aligning with Handler behavior.
- Relocated HandlerManager into core module due to tight coupling with Logger logic.
- Refactored Logger class into layered structure for better separation of concerns and extensibility.
- Unified formatter for all platforms; replaced platform separation with type-based strategy.
- Added edge support via  module to ensure compatibility without Node.js globals.
- Introduced  module exposing base handler classes (BaseHandler, NodeHandler, BrowserHandler, etc.) for developer extension.
- Cleaned up examples and benchmarks for clarity.
- Reorganized and updated test suite under .

449 of 499 branches covered (89.98%)

Branch coverage included in aggregate %.

2153 of 2176 new or added lines in 88 files covered. (98.94%)

17 existing lines in 3 files now uncovered.

4175 of 4292 relevant lines covered (97.27%)

4.71 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

69.77
/src/shared/utils/is-dev-mode.ts
1
/* eslint-disable @typescript-eslint/no-explicit-any */
1✔
2

1✔
3
import { isNode } from "@/shared/utils/is-node";
1✔
4

1✔
5
/**
1✔
6
 * Detects if the current runtime environment is in development mode.
1✔
7
 *
1✔
8
 * In Node.js, it checks the NODE_ENV environment variable:
1✔
9
 * - If NODE_ENV is set, returns true unless it's 'production'.
1✔
10
 * - If NODE_ENV is undefined, defaults to development mode (true).
1✔
11
 *
1✔
12
 * In browsers, it checks the global `__LOGRY_DEV__` flag:
1✔
13
 * - Returns true if `__LOGRY_DEV__` is explicitly set to a truthy value.
1✔
14
 * - Defaults to production mode (false) if the flag is undefined.
1✔
15
 *
1✔
16
 * This design assumes Node defaults to development for ease of local testing,
1✔
17
 * while browsers default to production to avoid unnecessary debug logs.
1✔
18
 *
1✔
19
 * @returns boolean indicating if running in development mode
1✔
20
 */
1✔
21
export const isDevMode = (): boolean => {
1✔
22
  if (isNode()) {
7✔
23
    // Check NODE_ENV in Node
7✔
24
    const nodeEnv =
7✔
25
      process?.env?.NODE_ENV ?? (globalThis as any).process?.env?.NODE_ENV;
7!
26

7✔
27
    if (typeof nodeEnv === "string") {
7✔
28
      return nodeEnv !== "production";
7✔
29
    }
7✔
UNCOV
30
    return true; // Assume dev if NODE_ENV is undefined
×
UNCOV
31
  }
×
UNCOV
32

×
UNCOV
33
  // Browser fallback via global flag
×
UNCOV
34
  if (typeof (globalThis as any).__LOGRY_DEV__ !== "undefined") {
×
UNCOV
35
    return Boolean((globalThis as any).__LOGRY_DEV__);
×
UNCOV
36
  }
×
UNCOV
37

×
UNCOV
38
  // Default fallback
×
UNCOV
39
  return false;
×
UNCOV
40
};
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc