<commit_before>%%%-------------------------------------------------------------------
%%% File : terminal_logger.erl
%%% Author : <NAME> <<EMAIL>>
%%% Created : 2009/06/01
%%% Description :
%%%     Simple terminal logger from the erlang documentation.
%%%
%%% Copyright 2009 <NAME> <<EMAIL>>
%%%
%%% This software is licensed as described in the file LICENSE, which
%%% you should have received as part of this distribution.
%%%-------------------------------------------------------------------
-module(terminal_logger).
-behaviour(gen_event).

-export([init/1, handle_event/2, terminate/2]).

%% trace is enabled by default
init(_Args) ->
	{ok, true}.

%% activate or not the trace
handle_event({trace, Trace}, _State) ->
	{ok, Trace};

%% display the message
handle_event(Msg, State) ->
	if
		State ->
			io:format(" -> ~p~n", [Msg]);
		true ->
			true
	end,
	{ok, State}.

terminate(_Args, _State) ->
	ok.
<commit_msg>Add a better logger with io:format capabilities.<commit_after>%%%-------------------------------------------------------------------
%%% File : terminal_logger.erl
%%% Author : <NAME> <<EMAIL>>
%%% Created : 2009/06/01
%%% Description :
%%%     Simple terminal logger from the erlang documentation.
%%%
%%% Copyright 2009 <NAME> <<EMAIL>>
%%%
%%% This software is licensed as described in the file LICENSE, which
%%% you should have received as part of this distribution.
%%%-------------------------------------------------------------------
-module(terminal_logger).
-behaviour(gen_event).

-export([init/1, handle_event/2, terminate/2]).

%% trace is enabled by default
init(_Args) ->
	{ok, true}.

%% activate or not the trace
handle_event({trace, Trace}, _State) ->
	{ok, Trace};

%% display a simple message
handle_event({Msg, Args}, State) ->
	if
		State ->
			Format = string:concat(Msg, "~n"),
			io:format(Format, Args);
		true ->
			true
	end,
	{ok, State}.

terminate(_Args, _State) ->
	ok.

{'fraction_non_alphanumeric': 0.28675324675324676, 'fraction_numerical': 0.015584415584415584, 'mean_word_length': 2.2533783783783785, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 28, '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': '2230748', 'n_tokens_mistral': 599, 'n_tokens_neox': 553, 'n_words': 172}