Skip to content

Commit

Permalink
Merge pull request #253 from olafbuitelaar/env_fix_v4.8.5
Browse files Browse the repository at this point in the history
fix nodejs environment usage in browser environments for v4.8.5
  • Loading branch information
terehov authored Aug 6, 2023
2 parents 773fd33 + 13bfb80 commit c4dc319
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class Logger<LogObj> extends BaseLogger<LogObj> {
// style only for blink browsers
settings.stylePrettyLogs = settings.stylePrettyLogs && isBrowser && !isBrowserBlinkEngine ? false : settings.stylePrettyLogs;

super(NodeRuntime, settings, logObj, isSafari ? 4 : 5);
super(isBrowser && typeof(process) === 'undefined' ? BrowserRuntime : NodeRuntime, settings, logObj, isSafari ? 4 : 5);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/nodejs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export interface IMeta extends IMetaStatic {

const meta: IMetaStatic = {
runtime: "Nodejs",
runtimeVersion: process.version,
hostname: hostname(),
runtimeVersion: (typeof process !== 'undefined') ? process.version : null,
hostname: hostname ? hostname() : null,
};

export function getMeta(
Expand Down

0 comments on commit c4dc319

Please sign in to comment.