anchor.diff:  
   -record (state, {
     filename,
  +  log_level,
     log_handle
   }).
  +
  +% Log levels
  +%   0 - quiet (no logs)
  +%   1 - error messages only
  +%   2 - verbose
  +%   3 - full logs with debugging messages
  +%   4 - heavy logging with speed
  +
   %%====================================================================
   %% gen_event callbacks
   %%====================================================================
  
positive.code:   {ok, State}.
    
  % INTERNAL FUNCTIONS
  write(Level, Message, #state{log_handle = Fd} = _State) ->
    % Check levels here, eventually
    Msg = io_lib:format("[~s] [~s] ~s\r\n", [httpd_util:rfc1123_date(), Level, Message]),
    io:format("~s", [Msg]),     % write to console 
    io:format(Fd, "~s", [Msg]). % write to file
  
negative.code: %% this function is called to initialize the event handler.
  %%--------------------------------------------------------------------
  init([]) ->
    LogPath  = misc_utils:to_list(config:search_for_application_value(log_path, "./logs", beehive)),
    LogLevel = misc_utils:to_list(config:search_for_application_value(log_level, info, beehive)),
    % Get the full path for the file
    LogName1 = misc_utils:to_list(config:search_for_application_value(node_type, node, beehive)),
    LogName = lists:append([LogName1, ".", misc_utils:to_list(LogLevel)]),
    FullFilepath = filename:join([LogPath, lists:append([LogName, ".log"])]),
    
    Fd = ensure_logfile_exists(FullFilepath),
    
    {ok, #state{filename = FullFilepath, log_handle = Fd, log_level = LogLevel}}.
  
  %%--------------------------------------------------------------------
  %% Function:
  