From 8960597b7d8bda43e3e96c0c2e1c3752c30a9fcd Mon Sep 17 00:00:00 2001 From: SisMaker <1713699517@qq.com> Date: Tue, 16 Mar 2021 14:07:17 +0800 Subject: [PATCH] =?UTF-8?q?ft:=20rumCrashLog.erl=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/eFmt.erl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/eFmt.erl b/src/eFmt.erl index a7b98c6..6d474fb 100644 --- a/src/eFmt.erl +++ b/src/eFmt.erl @@ -10,6 +10,9 @@ format/2 , format/3 + , formatBin/2 + , formatBin/3 + , scan/2 , build/1 , build/2 @@ -60,6 +63,22 @@ format(Format, Args, Options) -> erlang:error(badarg, [Format, Args]) end. +-spec formatBin(Format :: io:format(), Data :: [term()]) -> chars(). +formatBin(Format, Args) -> + try iolist_to_binary(fWrite(Format, Args)) + catch + _C:_R:S -> + erlang:error(badarg, [Format, Args, _C, _R, S]) + end. + +-spec formatBin(Format :: io:format(), Data :: [term()], Options :: [{charsLimit, CharsLimit :: charsLimit()}]) -> chars(). +formatBin(Format, Args, Options) -> + try iolist_to_binary(fWrite(Format, Args, Options)) + catch + _C:_R -> + erlang:error(badarg, [Format, Args]) + end. + -spec scan(Format :: io:format(), Data :: [term()]) -> FormatList :: [char() | fmtSpec()]. scan(Format, Args) -> try fScan(Format, Args)