Current section

Files

Jump to
gleamy_lights src gleamy_lights@console.erl
Raw

src/gleamy_lights@console.erl

-module(gleamy_lights@console).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([log/1, info/1, error/1, warn/1]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
-file("src/gleamy_lights/console.gleam", 15).
?DOC(
" # console.log()\n"
" A simple function to print a string to the console.\n"
" This function is a drop-in for the `println` function, so that JS colour support is ensured,\n"
" even on browsers.\n"
"\n"
" Mainly meant for packages that are ran everywhere, like Gleam libraries.\n"
"\n"
" If you stay in the console just use the `gleam/io` module.\n"
" There's no need to use this function then.\n"
"\n"
" Note: Nested colours are not yet supported.\n"
).
-spec log(binary()) -> nil.
log(Str) ->
gleam_stdlib:println(Str).
-file("src/gleamy_lights/console.gleam", 33).
?DOC(
" # console.info()\n"
" A simple function to print a message to the console.\n"
" This function is a drop-in for the `println` function, so that JS colour support is ensured,\n"
" even on browsers.\n"
"\n"
" Mainly meant for packages that are ran everywhere, like Gleam libraries.\n"
"\n"
" If you stay in the console just use the `gleam/io` module.\n"
" There's no need to use this function then.\n"
"\n"
" Note: Nested colours are not yet supported.\n"
).
-spec info(binary()) -> nil.
info(Str) ->
gleam_stdlib:println(Str).
-file("src/gleamy_lights/console.gleam", 51).
?DOC(
" # console.error()\n"
" A simple function to print a error to the console.\n"
" This function is a drop-in for the `println` function, so that JS colour support is ensured,\n"
" even on browsers.\n"
"\n"
" Mainly meant for packages that are ran everywhere, like Gleam libraries.\n"
"\n"
" If you stay in the console just use the `gleam/io` module.\n"
" There's no need to use this function then.\n"
"\n"
" Note: Nested colours are not yet supported.\n"
).
-spec error(binary()) -> nil.
error(Str) ->
gleam_stdlib:println_error(Str).
-file("src/gleamy_lights/console.gleam", 69).
?DOC(
" # console.warn()\n"
" A simple function to print a warning to the console.\n"
" This function is a drop-in for the `println` function, so that JS colour support is ensured,\n"
" even on browsers.\n"
"\n"
" Mainly meant for packages that are ran everywhere, like Gleam libraries.\n"
"\n"
" If you stay in the console just use the `gleam/io` module.\n"
" There's no need to use this function then.\n"
"\n"
" Note: Nested colours are not yet supported.\n"
).
-spec warn(binary()) -> nil.
warn(Str) ->
gleam_stdlib:println_error(Str).