Namdak Tonpa 9 лет назад
Родитель
Сommit
a60d000833

+ 1 - 1
include/mad.hrl

@@ -1 +1 @@
--define(VERSION,"c9c90a").
+-define(VERSION,"1c37d2").


+ 1 - 1
src/compile/mad_app.erl

@@ -15,7 +15,7 @@ compile(File,_Inc,Bin,_Opt,_Deps) ->
     AppFile = filename:join(Bin, app_src_to_app(File)),
     Compiled = mad_compile:is_compiled(AppFile, File),
     if  Compiled =:= false ->
-        io:format("Writing ~s~n\r", [AppFile -- mad_utils:cwd()]),
+        mad:info("Writing ~s~n", [AppFile -- mad_utils:cwd()]),
         BeamFiles = filelib:wildcard("*.beam", Bin),
         Modules = [list_to_atom(filename:basename(X, ".beam")) || X <- BeamFiles],
         [Struct|_] = mad_utils:consult(File),

+ 2 - 2
src/compile/mad_dtl.erl

@@ -47,9 +47,9 @@ compile_erlydtl_files(Opts) ->
         BeamFile = file_to_beam(OutDir, atom_to_list(ModuleName)),
         Compiled = mad_compile:is_compiled(BeamFile, F),
         case Compiled of false ->
-             io:format("DTL Compiling ~s~n\r", [F -- mad_utils:cwd()]),
+             mad:info("DTL Compiling ~s~n", [F -- mad_utils:cwd()]),
              Res = erlydtl:compile(F, ModuleName, Opts3),
-             case Res of {error,Error} -> io:format("Error: ~p~n",[Error]);
+             case Res of {error,Error} -> mad:info("Error: ~p~n",[Error]);
                                     OK -> OK end;
              true -> ok end
     end,

+ 1 - 2
src/compile/mad_erl.erl

@@ -10,8 +10,7 @@ compile(File,Inc,Bin,Opt,Deps) ->
     Compiled = mad_compile:is_compiled(BeamFile, File),
     if  Compiled =:= false ->
         Opts1 = ?COMPILE_OPTS(Inc, Bin, Opt, Deps),
-%        io:format("Compiling ~s~n Opts ~p~n Deps~p~n", [File,Opts1,Deps]),
-        io:format("Compiling ~s~n", [File -- mad_utils:cwd()]),
+        mad:info("Compiling ~s~n", [File -- mad_utils:cwd()]),
         ret(compile:file(File, Opts1));
     true -> false end.
 

+ 1 - 1
src/compile/mad_port.erl

@@ -23,5 +23,5 @@ compile_port(Dir,Specs,Config) ->
        {_,Status,Report} = sh:run("cc",string:tokens(Args," "),binary,Dir,Env),
        case Status of
           0 -> false;
-          _ -> io:format("Port Compilation Error: ~p",[Report]), true end
+          _ -> mad:info("Port Compilation Error: ~p",[Report]), true end
       end || {Sys,Out,Files} <- Specs, Sys == System].

+ 2 - 2
src/ling/ling_disasm.erl

@@ -89,7 +89,7 @@ beam(Beam) -> %% {ok,#m{}}
 		decode_lambdas(FunBin, Atoms)
 	end,
 
-	%%io:format("Lambdas=~p~n", [Lambdas]),
+	%%mad:info("Lambdas=~p~n", [Lambdas]),
 
 	Attrs = case optional_chunk(Beam, ?ATTR_CHUNK) of
 	missing ->
@@ -127,7 +127,7 @@ beam(Beam) -> %% {ok,#m{}}
 	end,
 
 	lists:foreach(fun(Op) ->
-		%%io:format("~p~n", [Op]),
+		%%mad:info("~p~n", [Op]),
 		validate(Op)
 	end, Code),
 

+ 2 - 2
src/ling/ling_lib.erl

@@ -152,7 +152,7 @@ wrap([A,B,C,D], Body) ->
 	<<A,B,C,D,ChunkSize:32,Body/binary,0:PadSize/unit:8>>.
 
 atoms_chunk(#m{atoms=Atoms}) ->
-	%io:format("Atoms=~p~n", [Atoms]),
+	%mad:info("Atoms=~p~n", [Atoms]),
 	L = [<<(length(Atoms)):32>>] ++
 		[[length(atom_to_list(A))] ++ atom_to_list(A) || A <- Atoms],
 	list_to_binary(L).
@@ -188,7 +188,7 @@ strings_chunk(#m{strings=StrTabBin}) ->
 	StrTabBin.
 
 literals_chunk(#m{literals=Literals}) ->
-	%io:format("Literals=~p~n", [Literals]),
+	%mad:info("Literals=~p~n", [Literals]),
 	EncLits = [term_to_binary(Lit) || Lit <- Literals],
 	L = [<<(length(Literals)):32>>] ++
 		[<<(byte_size(EncLit)):32,EncLit/binary>> || EncLit <- EncLits],

+ 28 - 25
src/mad.erl

@@ -8,10 +8,10 @@ main([]) -> help();
 main(Params) ->
 
     {Other,FP} = mad_utils:fold_params(Params),
-    %io:format("Params: ~p~n\r",[FP]),
+    %mad:info("Params: ~p~n",[FP]),
     case Other == [] of
          true -> skip;
-         false -> io:format("Unknown Command or Parameter ~p~n\r",[Other]), help() end,
+         false -> mad:info("Unknown Command or Parameter ~p~n",[Other]), help() end,
 
     Cwd           = mad_utils:cwd(),
     ConfigFile    = "rebar.config",
@@ -27,7 +27,7 @@ bool(_) -> 1.
 
 %% fetch dependencies
 deps(Cwd, ConfigFile, Conf, Params) ->
-    io:format("Deps Params: ~p~n",[Params]),
+    mad:info("Deps Params: ~p~n",[Params]),
     case mad_utils:get_value(deps, Conf, []) of
         [] -> false;
         Deps ->
@@ -42,7 +42,7 @@ deps(Cwd, ConfigFile, Conf, Params) ->
 
 %% compile dependencies and the app
 compile(Cwd, ConfigFile, Conf, Params) ->
-    io:format("Compile Params: ~p~n\r",[Params]),
+    mad:info("Compile Params: ~p~n",[Params]),
     Res = case Params of
          [] -> mad_compile:'compile-deps'(Cwd, ConfigFile, Conf);
          __ -> mad_compile:deps(Cwd, Conf, ConfigFile, Params)
@@ -53,70 +53,73 @@ compile(Cwd, ConfigFile, Conf, Params) ->
 
 %% reltool apps resolving
 plan(_Cwd,_ConfigFileName,_Config,Params) ->
-    io:format("Plan Params: ~p~n",[Params]),
+    mad:info("Plan Params: ~p~n",[Params]),
     mad_plan:main([]).
 
 repl(_Cwd,_ConfigFileName,_Config,Params) ->
-    io:format("REPL Params: ~p~n",[Params]),
+    mad:info("REPL Params: ~p~n",[Params]),
     mad_repl:main(Params,_Config).
 
 bundle(_Cwd,_ConfigFileName,_Config,Params) ->
-    io:format("Bundle Params: ~p~n",[Params]),
+    mad:info("Bundle Params: ~p~n",[Params]),
     Name = case Params of [] -> mad_utils:cwd(); E -> E end,
     mad_bundle:main(filename:basename(Name)).
 
 up(_Cwd,_ConfigFileName,_Config,Params) ->
-    io:format("Up Params: ~p~n",[Params]),
+    mad:info("Up Params: ~p~n",[Params]),
     mad_deps:up(_Config,Params).
 
 ling(_Cwd,_ConfigFileName,_Config,Params) ->
-    io:format("Ling Params: ~p~n",[Params]),
+    mad:info("Ling Params: ~p~n",[Params]),
     Name = case Params of [] -> mad_utils:cwd(); E -> E end,
     mad_ling:main(filename:basename(Name)).
 
 app(_Cwd,_ConfigFileName,_Config,Params) ->
-    io:format("Create App Params: ~p~n",[Params]),
+    mad:info("Create App Params: ~p~n",[Params]),
     mad_create:app(Params).
 
 lib(_Cwd,_ConfigFileName,_Config,Params) ->
-    io:format("Create Lib Params: ~p~n",[Params]),
+    mad:info("Create Lib Params: ~p~n",[Params]),
     mad_create:lib(Params).
 
 clean(_Cwd,_ConfigFileName,_Config,Params) ->
-    io:format("Clean Params: ~p~n",[Params]),
+    mad:info("Clean Params: ~p~n",[Params]),
     mad_run:clean(Params).
 
 start(_Cwd,_ConfigFileName,_Config,Params) ->
-    io:format("Start Params: ~p~n",[Params]),
+    mad:info("Start Params: ~p~n",[Params]),
     mad_run:start(Params), false.
 
 attach(_Cwd,_ConfigFileName,_Config,Params) ->
-    io:format("Attach Params: ~p~n",[Params]),
+    mad:info("Attach Params: ~p~n",[Params]),
     mad_run:attach(Params), false.
 
 stop(_Cwd,_ConfigFileName,_Config,Params) ->
-    io:format("Stop Params: ~p~n",[Params]),
+    mad:info("Stop Params: ~p~n",[Params]),
     mad_run:stop(Params), false.
 
 release(_Cwd,_ConfigFileName,_Config,Params) ->
-    io:format("Release Params: ~p~n",[Params]),
+    mad:info("Release Params: ~p~n",[Params]),
     mad_release:main(Params).
 
 static(_Cwd,_ConfigFileName,Config,Params) ->
-    io:format("Compile Static Params: ~p~n",[Params]),
+    mad:info("Compile Static Params: ~p~n",[Params]),
     mad_static:main(Config, Params).
 
 version() -> ?VERSION.
 help(Reason, Data) -> help(io_lib:format("~s ~p", [Reason, Data])).
-help(Msg) -> io:format("Error: ~s~n~n", [Msg]), help().
+help(Msg) -> mad:info("Error: ~s~n~n", [Msg]), help().
 help() ->
-    io:format("MAD Build Tool version ~s~n",[version()]),
-    io:format("BNF: ~n"),
-    io:format("    invoke := mad params~n"),
-    io:format("    params := [] | run params ~n"),
-    io:format("       run := command [ options ]~n"),
-    io:format("   command := app | lib | deps | up | compile | release | bundle~n"),
-    io:format("              clean | start | stop | attach | repl ~n"),
+    mad:info("MAD Build Tool version ~s~n",[version()]),
+    mad:info("BNF: ~n"),
+    mad:info("    invoke := mad params~n"),
+    mad:info("    params := [] | run params ~n"),
+    mad:info("       run := command [ options ]~n"),
+    mad:info("   command := app | lib | deps | up | compile | release | bundle~n"),
+    mad:info("              clean | start | stop | attach | repl ~n"),
     return(0).
 
+info(Format) -> io:format(lists:concat([Format,"\r"])).
+info(Format,Args) -> io:format(lists:concat([Format,"\r"]),Args).
+
 return(X) -> X.

+ 11 - 11
src/mad_compile.erl

@@ -19,17 +19,17 @@ dep(Cwd, _Conf, ConfigFile, Name) ->
     %% check dependencies of the dependency
     DepsDir = filename:join([mad_utils:get_value(deps_dir, _Conf, ["deps"])]),
     DepPath = filename:join([Cwd, DepsDir, Name]),
-    io:format("==> ~p~n\r",[Name]),
+    mad:info("==> ~p~n",[Name]),
 
     DepConfigFile = filename:join(DepPath, ConfigFile),
     Conf = mad_utils:consult(DepConfigFile),
     Conf1 = mad_script:script(DepConfigFile, Conf, Name),
     Deps = mad_utils:get_value(deps, Conf1, []),
     DepsRes = deps(Cwd, Conf, ConfigFile, Deps),
-    %io:format("DepsStatus: ~p~n",[DepsRes]),
+    %mad:info("DepsStatus: ~p~n",[DepsRes]),
 
     SrcDir = filename:join([mad_utils:src(DepPath)]),
-    %io:format("DepPath ==> ~p~n\r",[DepPath]),
+    %mad:info("DepPath ==> ~p~n",[DepPath]),
 
     AllFiles = files(SrcDir,".yrl") ++ 
                files(SrcDir,".xrl") ++ 
@@ -51,7 +51,7 @@ dep(Cwd, _Conf, ConfigFile, Name) ->
             Includes = lists:flatten([
                 [{i,filename:join([DepPath,L,D,include])} || D<-mad_utils:raw_deps(Deps) ] % for -include
              ++ [{i,filename:join([DepPath,L])}] || L <- LibDirs ]), % for -include_lib
-            %io:format("DepPath ~p~n Includes: ~p~nLibDirs: ~p~n",[DepPath,Includes,LibDirs]),
+            %mad:info("DepPath ~p~n Includes: ~p~nLibDirs: ~p~n",[DepPath,Includes,LibDirs]),
 
             % create EbinDir and add it to code path
             file:make_dir(EbinDir),
@@ -63,9 +63,9 @@ dep(Cwd, _Conf, ConfigFile, Name) ->
             FilesStatus = compile_files(Files,IncDir, EbinDir, Opts,Includes),
             DTLStatus = mad_dtl:compile(DepPath,Conf1),
             PortStatus = lists:any(fun(X)->X end,mad_port:compile(DepPath,Conf1)),
-            %io:format("DTL Status: ~p~n",[DTLStatus]),
-            %io:format("Port Status: ~p~n",[PortStatus]),
-            %io:format("Files Status: ~p~n",[FilesStatus]),
+            %mad:info("DTL Status: ~p~n",[DTLStatus]),
+            %mad:info("Port Status: ~p~n",[PortStatus]),
+            %mad:info("Files Status: ~p~n",[FilesStatus]),
 
             put(Name, compiled),
             DepsRes orelse FilesStatus orelse DTLStatus orelse PortStatus
@@ -76,7 +76,7 @@ compile_files([File|Files],Inc,Bin,Opt,Deps) ->
     case (module(filetype(File))):compile(File,Inc,Bin,Opt,Deps) of
          true -> true;
          false -> compile_files(Files,Inc,Bin,Opt,Deps);
-         _ -> io:format("Error: ~p~n",[{File}]) end.
+         _ -> mad:info("Error: ~p~n",[{File}]) end.
 
 module("erl") -> mad_erl;
 module("erl.src") -> mad_utils;
@@ -91,7 +91,7 @@ is_compiled(BeamFile, File) -> mad_utils:last_modified(BeamFile) >= mad_utils:la
 
 'compile-apps'(Cwd, ConfigFile, Conf) ->
     Dirs = mad_utils:sub_dirs(Cwd, ConfigFile, Conf),
-    %io:format("Compile Apps: ~p~n",[Dirs]),
+    %mad:info("Compile Apps: ~p~n",[Dirs]),
     case Dirs of
            [] -> mad_compile:dep(Cwd,  Conf, ConfigFile, Cwd);
          Apps -> mad_compile:dep(Cwd,  Conf, ConfigFile, Cwd),
@@ -105,9 +105,9 @@ list(X) -> X.
 
 erlc(DepPath) ->
     ErlFiles = filelib:wildcard(DepPath++"/src/**/*.erl"),
-    io:format("Files: ~s~n\r",[[filename:basename(Erl)++" " ||Erl<-ErlFiles]]),
+    mad:info("Files: ~s~n",[[filename:basename(Erl)++" " ||Erl<-ErlFiles]]),
     {_,Status,X} = sh:run("erlc",["-o"++DepPath++"/ebin/","-I"++DepPath++"/include"]++
         ErlFiles,binary,filename:absname("."),[{"ERL_LIBS","apps:deps"}]),
     case Status == 0 of
          true -> skip;
-         false -> io:format("Error: ~s~n\r",[binary_to_list(X)]) end.
+         false -> mad:info("Error: ~s~n",[binary_to_list(X)]) end.

+ 1 - 1
src/mad_create.erl

@@ -9,7 +9,7 @@ app(Params) ->
     Apps = ets:tab2list(filesystem),
     [ case string:str(File,"priv/web") of
        1 -> Relative = Name ++ string:substr(File, 9),
-            io:format("Create File: ~p~n",[Relative]),
+            mad:info("Create File: ~p~n",[Relative]),
             filelib:ensure_dir(Relative),
             file:write_file(Relative,Bin);
        _ -> skip

+ 4 - 4
src/mad_deps.erl

@@ -4,7 +4,7 @@
 
 pull(_,[])         -> false;
 pull(Config,[F|T]) ->
-    io:format("==> up: ~p~n", [F]),
+    mad:info("==> up: ~p~n", [F]),
     {_,Status,Message} = sh:run(lists:concat(["cd ",F," && git pull && cd -"])),
     case Status of
          0 -> mad_utils:verbose(Config,Message), pull(Config,T);
@@ -49,7 +49,7 @@ fetch_dep(Cwd, Config, ConfigFile, Name, Cmd, Uri, Co, Cache) ->
         deps_fetch -> filename:join([mad_utils:get_value(deps_dir,Config,"deps"),Name]);
         Dir -> filename:join([Dir,get_publisher(Uri),Name]) end,
 
-    io:format("==> dependency: ~p tag: ~p~n\r", [Uri,Co]),
+    mad:info("==> dependency: ~p tag: ~p~n", [Uri,Co]),
 
     Fast = case mad_utils:get_value(fetch_speed,Config,[]) of
                 fast_master -> " --depth=1 ";
@@ -60,7 +60,7 @@ fetch_dep(Cwd, Config, ConfigFile, Name, Cmd, Uri, Co, Cache) ->
         {_,Rev} -> git_clone(Uri,Fast,TrunkPath,Rev);
         Master  -> git_clone(Uri,Fast,TrunkPath,Master) end,
 
-    %io:format("Fetch: ~s~n",[R]),
+    %mad:info("Fetch: ~s~n",[R]),
 
     FetchStatus = case filelib:is_dir(TrunkPath) of
                        true -> {skip,0,list_to_binary("Directory "++TrunkPath++" exists.")};
@@ -79,7 +79,7 @@ fetch_dep(Cwd, Config, ConfigFile, Name, Cmd, Uri, Co, Cache) ->
                          CacheDir -> build_dep(Cwd, Config, ConfigFile,
                                         get_publisher(Uri), Name, Cmd, Co1, CacheDir)
                     end;
-    {_,_,FetchError} -> io:format("Fetch Error: ~s~n",[binary_to_list(FetchError)]), true end.
+    {_,_,FetchError} -> mad:info("Fetch Error: ~s~n",[binary_to_list(FetchError)]), true end.
 
 %% build dependency based on branch/tag/commit
 build_dep(Cwd, Conf, _ConfFile, Publisher, Name, _Cmd, _Co, Dir) ->

+ 19 - 19
src/mad_ling.erl

@@ -6,13 +6,13 @@
 -define(ARCH, list_to_atom( case os:getenv("ARCH") of false -> "posix"; A -> A end)).
 
 main(_App) ->
-    io:format("ARCH: ~p~n",         [?ARCH]),
-    io:format("Bundle Name: ~p~n",  [mad_repl:local_app()]),
-    io:format("System: ~p~n",       [mad_repl:system()]),
-    io:format("Apps: ~p~n",         [mad_repl:applist()]),
-%    io:format("Overlay: ~p~n",      [[{filename:basename(N),size(B)}||{N,B} <- mad_bundle:overlay()]]),
-%    io:format("Files: ~p~n",        [[{filename:basename(N),size(B)}||{N,B} <- bundle()]]),
-    io:format("Overlay: ~p~n",      [[filename:basename(N)||{N,_B} <- mad_bundle:overlay()]]),
+    mad:info("ARCH: ~p~n",         [?ARCH]),
+    mad:info("Bundle Name: ~p~n",  [mad_repl:local_app()]),
+    mad:info("System: ~p~n",       [mad_repl:system()]),
+    mad:info("Apps: ~p~n",         [mad_repl:applist()]),
+%    mad:info("Overlay: ~p~n",      [[{filename:basename(N),size(B)}||{N,B} <- mad_bundle:overlay()]]),
+%    mad:info("Files: ~p~n",        [[{filename:basename(N),size(B)}||{N,B} <- bundle()]]),
+    mad:info("Overlay: ~p~n",      [[filename:basename(N)||{N,_B} <- mad_bundle:overlay()]]),
     add_apps(),
     false.
 
@@ -48,28 +48,28 @@ boot(Ordered) ->
     BootCode = element(2,file:read_file(lists:concat([code:root_dir(),"/bin/start.boot"]))),
     { script, Erlang, Boot } = binary_to_term(BootCode),
     AutoLaunch = {script,Erlang,Boot++[{apply,{application,start,[App]}} || App <- Ordered]},
-    io:format("Boot Code: ~p~n",[AutoLaunch]),
+    mad:info("Boot Code: ~p~n",[AutoLaunch]),
     { boot, "start.boot", term_to_binary(AutoLaunch) }.
 
 add_apps() ->
     {ok,Ordered} = mad_plan:orderapps(),
     Bucks = [{boot,"/boot",[local_map, boot(Ordered)]}] ++ [ lib(E) || E <- apps(Ordered) ],
-    %io:format("Bucks: ~p~n",[[{App,Mount,[{filename:basename(F),size(Bin)}||{_,F,Bin}<-Files]}||{App,Mount,Files}<-Bucks]]),
-    io:format("Bucks: ~p~n",[[{App,Mount,length(Files)}||{App,Mount,Files}<-Bucks]]),
+    %mad:info("Bucks: ~p~n",[[{App,Mount,[{filename:basename(F),size(Bin)}||{_,F,Bin}<-Files]}||{App,Mount,Files}<-Bucks]]),
+    mad:info("Bucks: ~p~n",[[{App,Mount,length(Files)}||{App,Mount,Files}<-Bucks]]),
     filelib:ensure_dir(cache_dir()),
     EmbedFsPath = lists:concat([cache_dir(),"/embed.fs"]),
-    io:format("Initializing EMBED.FS:"),
+    mad:info("Initializing EMBED.FS:"),
     Res = embed_fs(EmbedFsPath,Bucks),
 	{ok, EmbedFsObject} = embedfs_object(EmbedFsPath),
 	Oneliner = ld() ++
                ["../deps/ling/core/vmling.o"] ++
                ["-lm", "-lpthread", "-ldl"] ++
                [EmbedFsObject, "-o", "../" ++ atom_to_list(mad_repl:local_app()) ++ ".img"],
-    io:format("LD: ~p~n",[Oneliner]),
+    mad:info("LD: ~p~n",[Oneliner]),
 	Res = case sh:oneliner(Oneliner,cache_dir()) of
 	           {_,0,_} -> ok;
 	           {_,_,M} -> binary_to_list(M) end,
-    io:format("Linking Image: ~p~n",[Res]).
+    mad:info("Linking Image: ~p~n",[Res]).
 
 embed_fs(EmbedFsPath,Bucks)  ->
     {ok, EmbedFs} = file:open(EmbedFsPath, [write]),
@@ -84,7 +84,7 @@ embed_fs(EmbedFsPath,Bucks)  ->
           file:write(EmbedFs, <<BuckNameSize, BuckName/binary, BuckBinCount:32>>),
           lists:foreach(fun
                     (local_map) -> LocalMap = local_map(Bucks),
-                                   io:format("~nMount View:~n ~s",[LocalMap]),
+                                   mad:info("~nMount View:~n ~s",[LocalMap]),
                                    write_bin(EmbedFs, "local.map", LocalMap);
                   ({_App,F,Bin}) -> write_bin(EmbedFs, filename:basename(F), Bin)
           end,Bins)
@@ -96,15 +96,15 @@ embedfs_object(EmbedFsPath) ->
 	EmbedCPath  = filename:join(filename:absname(cache_dir()), "embedfs.c"),
 	OutPath     = filename:join(filename:absname(cache_dir()), "embedfs.o"),
 	{ok, Embed} = file:read_file(EmbedFsPath),
-	io:format("Creating EMBED.FS C file: ..."),
+	mad:info("Creating EMBED.FS C file: ..."),
 	Res = bfd_objcopy:blob_to_src(EmbedCPath, "_binary_embed_fs", Embed),
-    io:format("~p~n",[Res]),
-	io:format("Compilation of Filesystem object: ..."),
+    mad:info("~p~n",[Res]),
+	mad:info("Compilation of Filesystem object: ..."),
 	Res = case sh:oneliner(cc() ++ ["-o", OutPath, "-c", EmbedCPath]) of
 	           {_,0,_} -> ok;
 	           {_,_,M} -> binary_to_list(M) end,
-	io:format("~p~n",[Res]),
-	io:format("Out Path: ~p~n",[OutPath]),
+	mad:info("~p~n",[Res]),
+	mad:info("Out Path: ~p~n",[OutPath]),
 	{ok, OutPath}.
 
 write_bin(Dev, F, Bin) ->

+ 3 - 3
src/mad_plan.erl

@@ -23,7 +23,7 @@ orderapps() ->
                      false -> {A,Name};
                      true -> [{A,Name}]++ system_deps(A) end || A <- Apps ];
          {error,_} ->
-            io:format("AppName: ~p~n",[F]), skip
+            mad:info("AppName: ~p~n",[F]), skip
     end || F <- mad_repl:wildcards(["{apps,deps}/*/ebin/*.app","ebin/*.app"]), not filelib:is_dir(F) ]),
     case sort(lists:flatten(Pairs)) of
          {ok,Sorted} -> {ok,Sorted};
@@ -36,6 +36,6 @@ system_deps(A) ->
 
 main(_) ->
     case orderapps() of
-         {ok,Ordered}   -> io:format("Ordered: ~p~n\r",[Ordered]),
+         {ok,Ordered}   -> mad:info("Ordered: ~p~n",[Ordered]),
                            file:write_file(".applist",io_lib:format("~w",[Ordered])), false;
-         {error,Reason} -> io:format("Ordering Error: ~p~n\r",[Reason]), true end.
+         {error,Reason} -> mad:info("Ordering Error: ~p~n",[Reason]), true end.

+ 1 - 1
src/mad_release.erl

@@ -19,4 +19,4 @@ main(Params) ->
     {_,Status,X} = sh:run("relx",[],binary,".",[]),
     case Status == 0 of
          true -> false;
-         false -> io:format("Shell Error: ~s~n\r",[binary_to_list(X)]), true end.
+         false -> mad:info("Shell Error: ~s~n",[binary_to_list(X)]), true end.

+ 2 - 2
src/mad_repl.erl

@@ -53,7 +53,7 @@ load_apps([],_,_Acc) ->
                     _E -> acc_start(_E,Acc) end end end,[], applist()),
   case Res of
        [] -> ok;
-       _ -> io:format("\r\nApps couldn't be loaded: ~p~n\n\r",[Res]) end;
+       _ -> mad:info("~nApps couldn't be loaded: ~p~n",[Res]) end;
 load_apps(["applist"],Config,Acc) -> load_apps([],Config,Acc);
 load_apps(Params,_,_Acc) -> [ application:ensure_all_started(list_to_atom(A))||A<-Params].
 
@@ -129,7 +129,7 @@ pre(Driver) -> appconfig(Driver).
 post(start_kjell) -> appconfig(start_kjell);
 post(_) -> [].
 print(Label,Value,start_kjell) -> io:requests([{put_chars,Label ++ normalize(length(Label)+1,Value) ++ "\n\r"}]);
-print(Label,Value,_) -> io:format("~s~p~n",[Label,Value]).
+print(Label,Value,_) -> mad:info("~s~p~n",[Label,Value]).
 normalize(Padding,V) -> [ case X of 10 -> [13,10]; E -> E end || X <- lists:flatten(pp(Padding,V) )].
 pp(Padding,V) -> k_io_lib_pretty:print(V, Padding, 80, 30, 60, fun(_,_)-> no end).
 appconfig(Driver) ->

+ 2 - 2
src/mad_run.erl

@@ -9,10 +9,10 @@ start(_) ->                            % run_dir > < log_dir
          {"ERL_LIBS","apps:deps"}]),
     case Status == 0 of
          true -> skip;
-         false -> io:format("Shell Error: ~s~n\r",[binary_to_list(X)]), exit({error,X}) end.
+         false -> mad:info("Shell Error: ~s~n",[binary_to_list(X)]), exit({error,X}) end.
 
 attach(_) ->
-    io:format("to_erl .~n"). % use like $(mad attach)
+    mad:info("to_erl .~n"). % use like $(mad attach)
 
 stop(_) -> ok. % TODO: stop box
 

+ 3 - 3
src/mad_static.erl

@@ -24,7 +24,7 @@ install_deps() ->
         _ ->
             case sh:oneliner("npm install mincer-erl") of
                 {_,0,_} -> false;
-                {_,_,_} -> io:format("error while installing mincer-erl~n"), true
+                {_,_,_} -> mad:info("error while installing mincer-erl~n"), true
             end
     end.
 
@@ -34,10 +34,10 @@ serve_static(Port) ->
     Res = sh:oneliner([?NODE("mincer-erl-serve"), "-p " ++ PortStr]),
     case Res of
         {_,0,_} -> false;
-        {_,_,_} -> io:format("error while serving assets~n"), true end.
+        {_,_,_} -> mad:info("error while serving assets~n"), true end.
 
 compile_static(Files) ->
     Res = sh:oneliner([?NODE("mincer-erl-compile")] ++ Files),
     case Res of
         {_,0,_} -> false;
-        {_,_,_} -> io:format("error while compiling assets~n"), true end.
+        {_,_,_} -> mad:info("error while compiling assets~n"), true end.

+ 1 - 1
src/mad_utils.erl

@@ -103,7 +103,7 @@ fold_params(Params) ->
 verbose(Config,Message) ->
     case mad_utils:get_value(verbose, Config, 0) of
          0 -> skip;
-         _ -> io:format("~s",[binary_to_list(Message)]) end.
+         _ -> mad:info("~s",[binary_to_list(Message)]) end.
 
 compile(_,_,_,_,_) -> false.