<commit_before>-module(caterpillar_sup).

-behaviour(supervisor).

-export([start_link/0]).
-export([init/1]).


start_link() ->
    supervisor:start_link({local, ?MODULE}, ?MODULE, application:get_all_env(caterpillar)).


init(Settings) ->
    init_logging(proplists:get_value(logs, Settings, [])),
    NetKernel = init_net_kernel(proplists:get_value(net_kernel, Settings, [])),
    Services = init_services(proplists:get_value(services, Settings, [])),
    {ok, {{one_for_one, 4, 3600}, [NetKernel] ++ Services}}.


init_logging(Settings) ->
    error_logger:add_report_handler(caterpillar_rotating_log_handler, Settings).


init_net_kernel(Settings) ->
    {caterpillar_net_kernel, {caterpillar_net_kernel, start_link, [Settings]}, transient, 5000, worker, []}.


init_services(Services) ->
    init_services(Services, []).


init_services([], Accum) ->
    lists:reverse(Accum);
init_services([{Name, Settings}|O], Accum) ->
    Service = {Name, {Name, start_link, [Settings]}, transient, 5000, worker, []},
    init_services(O, [Service|Accum]).
<commit_msg>just for rebuild<commit_after>-module(caterpillar_sup).

-behaviour(supervisor).

-export([start_link/0]).
-export([init/1]).


start_link() ->
    supervisor:start_link({local, ?MODULE}, ?MODULE, application:get_all_env(caterpillar)).


init(Settings) ->
    init_logging(proplists:get_value(logs, Settings, [])),
    NetKernel = init_net_kernel(proplists:get_value(net_kernel, Settings, [])),
    Services = init_services(proplists:get_value(services, Settings, [])),
    {ok, {{one_for_one, 4, 3600}, [NetKernel|Services]}}.


init_logging(Settings) ->
    error_logger:add_report_handler(caterpillar_rotating_log_handler, Settings).


init_net_kernel(Settings) ->
    {caterpillar_net_kernel, {caterpillar_net_kernel, start_link, [Settings]}, transient, 5000, worker, []}.


init_services(Services) ->
    init_services(Services, []).


init_services([], Accum) ->
    lists:reverse(Accum);
init_services([{Name, Settings}|O], Accum) ->
    Service = {Name, {Name, start_link, [Settings]}, transient, 5000, worker, []},
    init_services(O, [Service|Accum]).

{'fraction_non_alphanumeric': 0.16792097836312322, 'fraction_numerical': 0.014111006585136407, 'mean_word_length': 6.01980198019802, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4518384', 'n_tokens_mistral': 790, 'n_tokens_neox': 732, 'n_words': 107}