mirror of
https://github.com/oven-sh/bun
synced 2026-02-14 12:51:54 +00:00
bindings: make messageWithTypeAndLevel a ConsoleObject method
This commit is contained in:
@@ -79,8 +79,7 @@ threadlocal var stdout_lock_count: u16 = 0;
|
||||
|
||||
/// https://console.spec.whatwg.org/#formatter
|
||||
pub fn messageWithTypeAndLevel(
|
||||
//console_: ConsoleObject.Type,
|
||||
_: ConsoleObject.Type,
|
||||
console: *ConsoleObject,
|
||||
message_type: MessageType,
|
||||
//message_level: u32,
|
||||
level: MessageLevel,
|
||||
@@ -92,8 +91,6 @@ pub fn messageWithTypeAndLevel(
|
||||
return;
|
||||
}
|
||||
|
||||
var console = global.bunVM().console;
|
||||
|
||||
// Lock/unlock a mutex incase two JS threads are console.log'ing at the same time
|
||||
// We do this the slightly annoying way to avoid assigning a pointer
|
||||
if (level == .Warning or level == .Error or message_type == .Assert) {
|
||||
@@ -3439,7 +3436,7 @@ pub fn takeHeapSnapshot(
|
||||
) callconv(JSC.conv) void {
|
||||
// TODO: this does an extra JSONStringify and we don't need it to!
|
||||
var snapshot: [1]JSValue = .{globalThis.generateHeapSnapshot()};
|
||||
ConsoleObject.messageWithTypeAndLevel(undefined, MessageType.Log, MessageLevel.Debug, globalThis, &snapshot, 1);
|
||||
globalThis.bunVM().console.messageWithTypeAndLevel(.Log, .Debug, globalThis, &snapshot, 1);
|
||||
}
|
||||
pub fn timeStamp(
|
||||
// console
|
||||
|
||||
@@ -4597,8 +4597,7 @@ pub const JSValue = enum(JSValueReprInt) {
|
||||
message_type: ConsoleObject.MessageType,
|
||||
message_level: ConsoleObject.MessageLevel,
|
||||
) void {
|
||||
JSC.ConsoleObject.messageWithTypeAndLevel(
|
||||
undefined,
|
||||
globalObject.bunVM().console.messageWithTypeAndLevel(
|
||||
message_type,
|
||||
message_level,
|
||||
globalObject,
|
||||
|
||||
Reference in New Issue
Block a user