forked from CorticalComputer/DXNN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
logger.erl
50 lines (45 loc) · 1.48 KB
/
logger.erl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
%% This source code and work is provided and developed by DXNN Research Group WWW.DXNNResearch.COM
%%
%Copyright (C) 2009 by Gene Sher, DXNN Research Group, CorticalComputer@gmail.com
%All rights reserved.
%
%This code is licensed under the version 3 of the GNU General Public License. Please see the LICENSE file that accompanies this project for the terms of use.
-module(logger).
-compile(export_all).
-include("forex_db.hrl").
-include("records.hrl").
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Logger Options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
start()->
PId = spawn(logger,server,[void]),
register(logger,PId).
stop()->
logger ! {self(),stop}.
server(void)->
receive
{_From, start_logger}->
logger:server(high);
{_From, start_logger,Log_Type}->
logger:server(Log_Type);
{_From, stop}->
io:format("Logger is shutting down normally.~n");
MSG ->
io:format("MSG:~p~n",[MSG]),
logger:server(void)
end;
server(Log_Type)->
receive
{log_info,Info}->
display_info(Log_Type,Info),
logger:server(Log_Type);
{new_LT,New_LogType}->
logger:server(New_LogType)
end.
display_info(Log_Type,Info)->
case Log_Type of
all ->
io:format("***** Loging Type:~p *****~n",[Log_Type]),
io:format("Logger Info:~p~n",[Info]);
none ->
done
end.