Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BrowserLogger: Use Console API functions for logs without data #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 12 additions & 16 deletions src/BrowserLogger.re
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,18 @@ external debugGroup:
"group";

[@bs.val] [@bs.scope "console"]
external debugGroupCollapsed:
external debugJs:
(
[@bs.as "%c DEBUG "] _,
[@bs.as "background: #82658c; color: #fff;"] _,
'a,
'b
) =>
unit =
"groupCollapsed";
"debug";

let debug = (__module__: string, event: 'a) => {
__module__->Module.format->debugGroupCollapsed(event);
groupEnd();
__module__->Module.format->debugJs(event);
};

let debugWithData =
Expand Down Expand Up @@ -162,19 +161,18 @@ external infoGroup:
"group";

[@bs.val] [@bs.scope "console"]
external infoGroupCollapsed:
external infoJs:
(
[@bs.as "%c INFO "] _,
[@bs.as "background: #29d; color: #fff;"] _,
'a,
'b
) =>
unit =
"groupCollapsed";
"info";

let info = (__module__: string, event: 'a) => {
__module__->Module.format->infoGroupCollapsed(event);
groupEnd();
__module__->Module.format->infoJs(event);
};

let infoWithData =
Expand Down Expand Up @@ -305,19 +303,18 @@ external warnGroup:
"group";

[@bs.val] [@bs.scope "console"]
external warnGroupCollapsed:
external warnJs:
(
[@bs.as "%c WARNING "] _,
[@bs.as "background: #fce473; color: #573a08;"] _,
'a,
'b
) =>
unit =
"groupCollapsed";
"warn";

let warn = (__module__: string, event: 'a) => {
__module__->Module.format->warnGroupCollapsed(event);
groupEnd();
__module__->Module.format->warnJs(event);
};

let warnWithData =
Expand Down Expand Up @@ -448,19 +445,18 @@ external errorGroup:
"group";

[@bs.val] [@bs.scope "console"]
external errorGroupCollapsed:
external errorJs:
(
[@bs.as "%c ERROR "] _,
[@bs.as "background: #d11a1a; color: #fff;"] _,
'a,
'b
) =>
unit =
"groupCollapsed";
"error";

let error = (__module__: string, event: 'a) => {
__module__->Module.format->errorGroupCollapsed(event);
groupEnd();
__module__->Module.format->errorJs(event);
};

let errorWithData =
Expand Down