Skip to content

Commit

Permalink
Use LS30::Log::error()
Browse files Browse the repository at this point in the history
  • Loading branch information
nickandrew committed Feb 1, 2015
1 parent 7dd6871 commit 69f06e0
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion lib/AlarmDaemon/ClientSocket.pm
Expand Up @@ -124,7 +124,7 @@ sub handleRead {
if (!defined $n) {

# Error on the socket
LS30::Log::timePrint("Client socket error");
LS30::Log::error("Client socket error");
$handler->removeClient($self);
$self->disconnect();
return;
Expand Down
4 changes: 2 additions & 2 deletions lib/AlarmDaemon/Controller.pm
Expand Up @@ -70,7 +70,7 @@ sub addListener {

my $listener = AlarmDaemon::ListenSocket->new($socket, $self);
if (!$listener) {
LS30::Log::timePrint("Unable to add listener");
LS30::Log::error("Unable to add listener");
return;
}

Expand All @@ -91,7 +91,7 @@ sub addServer {

my $object = LS30Connection->new($peer_addr, reconnect => 1);
if (!$object) {
LS30::Log::timePrint("Unable to instantiate an LS30Connection to $peer_addr");
LS30::Log::error("Unable to instantiate an LS30Connection to $peer_addr");
return;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/AlarmDaemon/ServerSocket.pm
Expand Up @@ -200,7 +200,7 @@ sub connect {
);

if (!$socket) {
LS30::Log::timePrint("Cannot create a new socket to $self->{peer_addr}");
LS30::Log::error("Cannot create a new socket to $self->{peer_addr}");
if ($self->{on_connect_fail}) {
$self->{on_connect_fail}->($self);
}
Expand Down
12 changes: 6 additions & 6 deletions lib/LS30Client/RunScripts.pm
Expand Up @@ -44,12 +44,12 @@ sub new {
my $ls30c = $self->{ls30c};

$ls30c->onConnectFail(sub {
LS30::Log::timePrint("RunScripts: Connection to $server_address failed, retrying");
LS30::Log::error("RunScripts: Connection to $server_address failed, retrying");
shift->retryConnect();
});

$ls30c->onDisconnect(sub {
LS30::Log::timePrint("RunScripts: Disconnected from $server_address, retrying");
LS30::Log::error("RunScripts: Disconnected from $server_address, retrying");
shift->retryConnect();
});

Expand Down Expand Up @@ -89,7 +89,7 @@ sub addSelector {
sub disc_timer_event {
my ($ref, $selector) = @_;

LS30::Log::timePrint("Disconnected, retrying connect");
LS30::Log::error("Disconnected, retrying connect");
my $self = $ref->[1];
my $ls30c = $self->{ls30c};
my $timer = $self->{timer2};
Expand All @@ -102,7 +102,7 @@ sub disc_timer_event {
}

$ref->[2] += $ref->[3];
LS30::Log::timePrint(sprintf("Connect failed, retry in %d sec", $ref->[3]));
LS30::Log::error(sprintf("Connect failed, retry in %d sec", $ref->[3]));
$timer->setNextTime($ref->[2]);
} else {
LS30::Log::timePrint("Connected");
Expand Down Expand Up @@ -224,7 +224,7 @@ sub handleResponse {
my $resp_hr = LS30Command::parseResponse($line);

if (!$resp_hr) {
LS30::Log::timePrint("Received unexpected response $line");
LS30::Log::error("Received unexpected response $line");
return;
}

Expand All @@ -236,7 +236,7 @@ sub handleResponseMessage {
my ($self, $response_obj) = @_;

if (!$response_obj) {
LS30::Log::timePrint("Received unexpected response");
LS30::Log::error("Received unexpected response");
return;
}

Expand Down
8 changes: 4 additions & 4 deletions lib/LS30Connection.pm
Expand Up @@ -56,12 +56,12 @@ sub new {
if ($args{reconnect}) {

$args{on_connect_fail} = sub {
LS30::Log::timePrint("LS30Connection: Connection to $server_address failed, retrying");
LS30::Log::error("LS30Connection: Connection to $server_address failed, retrying");
shift->retryConnect();
};

$args{on_disconnect} = sub {
LS30::Log::timePrint("LS30Connection: Disconnected from $server_address, retrying");
LS30::Log::error("LS30Connection: Disconnected from $server_address, retrying");
shift->retryConnect();
};
}
Expand Down Expand Up @@ -217,7 +217,7 @@ sub runHandler {
my $object = $self->{handler};

if (!defined $object) {
LS30::Log::timePrint("Cannot run handler for $type");
LS30::Log::error("Cannot run handler for $type");
return;
}

Expand All @@ -234,7 +234,7 @@ sub runHandler {
} elsif ($type eq 'GSM') {
$object->handleGSM(@_);
} else {
LS30::Log::timePrint("No handler function defined for $type");
LS30::Log::error("No handler function defined for $type");
}
}

Expand Down
10 changes: 5 additions & 5 deletions lib/Watch.pm
Expand Up @@ -41,12 +41,12 @@ sub new {
my $ls30c = $self->{ls30c};

$ls30c->onConnectFail(sub {
LS30::Log::timePrint("Watch: Connection to $server_address failed, retrying");
LS30::Log::error("Watch: Connection to $server_address failed, retrying");
shift->retryConnect();
});

$ls30c->onDisconnect(sub {
LS30::Log::timePrint("Watch: Disconnected from $server_address, retrying");
LS30::Log::error("Watch: Disconnected from $server_address, retrying");
shift->retryConnect();
});

Expand Down Expand Up @@ -76,7 +76,7 @@ sub new {
sub disc_timer_event {
my ($ref) = @_;

LS30::Log::timePrint("Disconnected, retrying connect");
LS30::Log::error("Disconnected, retrying connect");
my $self = $ref->[1];
my $ls30c = $self->{ls30c};
my $timer = $self->{timer2};
Expand Down Expand Up @@ -137,7 +137,7 @@ sub handleResponse {
my $resp_hr = LS30Command::parseResponse($line);

if (!$resp_hr) {
LS30::Log::timePrint("Received unexpected response $line");
LS30::Log::error("Received unexpected response $line");
return;
}

Expand All @@ -149,7 +149,7 @@ sub handleResponseMessage {
my ($self, $response_obj) = @_;

if (!$response_obj) {
LS30::Log::timePrint("Received unexpected response");
LS30::Log::error("Received unexpected response");
return;
}

Expand Down
12 changes: 6 additions & 6 deletions lib/Watch2.pm
Expand Up @@ -43,12 +43,12 @@ sub new {
my $ls30c = $self->{ls30c};

$ls30c->onConnectFail(sub {
LS30::Log::timePrint("Watch2: Connection to $server_address failed, retrying");
LS30::Log::error("Watch2: Connection to $server_address failed, retrying");
shift->retryConnect();
});

$ls30c->onDisconnect(sub {
LS30::Log::timePrint("Watch2: Disconnected from $server_address, retrying");
LS30::Log::error("Watch2: Disconnected from $server_address, retrying");
shift->retryConnect();
});

Expand Down Expand Up @@ -78,7 +78,7 @@ sub new {
sub disc_timer_event {
my ($ref) = @_;

LS30::Log::timePrint("Disconnected, retrying connect");
LS30::Log::error("Disconnected, retrying connect");
my $self = $ref->[1];
my $ls30c = $self->{ls30c};
my $timer = $self->{timer2};
Expand All @@ -91,7 +91,7 @@ sub disc_timer_event {
}

$ref->[2] += $ref->[3];
LS30::Log::timePrint(sprintf("Connect failed, retry in %d sec", $ref->[3]));
LS30::Log::error(sprintf("Connect failed, retry in %d sec", $ref->[3]));
$timer->setNextTime($ref->[2]);
} else {
LS30::Log::timePrint("Connected");
Expand Down Expand Up @@ -196,7 +196,7 @@ sub handleResponse {
my $resp_hr = LS30Command::parseResponse($line);

if (!$resp_hr) {
LS30::Log::timePrint("Received unexpected response $line");
LS30::Log::error("Received unexpected response $line");
return;
}

Expand All @@ -208,7 +208,7 @@ sub handleResponseMessage {
my ($self, $response_obj) = @_;

if (!$response_obj) {
LS30::Log::timePrint("Received unexpected response");
LS30::Log::error("Received unexpected response");
return;
}

Expand Down

0 comments on commit 69f06e0

Please sign in to comment.