author | m2lahtel |
Tue, 10 Aug 2010 14:29:28 +0300 | |
changeset 3 | e7e0ae78773e |
parent 1 | b538b70cbe51 |
permissions | -rw-r--r-- |
1
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
1 |
# Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
2 |
# All rights reserved. |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
3 |
# This component and the accompanying materials are made available |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
4 |
# under the terms of "Eclipse Public License v1.0" |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
5 |
# which accompanies this distribution, and is available |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
6 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
7 |
# |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
8 |
# Initial Contributors: |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
9 |
# Nokia Corporation - initial contribution. |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
10 |
# |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
11 |
# Contributors: |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
12 |
# |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
13 |
# Description: |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
14 |
# |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
15 |
|
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
16 |
package LogItem; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
17 |
|
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
18 |
use FindBin; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
19 |
use lib $FindBin::Bin; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
20 |
use DepConstants; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
21 |
|
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
22 |
#------------------------------------------------------------------------------------------------- |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
23 |
# Subroutine: new |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
24 |
# Purpose: Constructor |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
25 |
# Input: None (extracted from command line args) |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
26 |
# Output: A reference to itself |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
27 |
#------------------------------------------------------------------------------------------------- |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
28 |
sub new() |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
29 |
{ |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
30 |
my $package = shift; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
31 |
my $self = {}; # Create reference to object |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
32 |
bless $self, $package; # Associate a reference with class name |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
33 |
my %parameters = @_; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
34 |
$self->{iMessage} = $parameters{'msg'} ? $parameters{'msg'} : ""; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
35 |
$self->{iCode} = $parameters{'code'} ? $parameters{'code'} : 0; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
36 |
$self->{iModule} = $parameters{'module'} ? $parameters{'module'} : 0; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
37 |
$self->{iSeverity} = $parameters{'severity'} ? $parameters{'severity'} : 3; # default is INFO |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
38 |
$self->{iDepth} = $parameters{'depth'} ? $parameters{'depth'} : 0; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
39 |
|
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
40 |
$self->{iCode} = &DepConstants::ModuleErrorCodes($self->{iModule}, $self->{iSeverity}) if $self->{iCode} == 0; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
41 |
|
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
42 |
$self->{iDate} = scalar(localtime); |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
43 |
return $self; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
44 |
} |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
45 |
|
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
46 |
sub Message() |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
47 |
{ |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
48 |
my $self = shift; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
49 |
$self->{iMessage} = $_[0] if $_[0]; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
50 |
return $self->{iMessage}; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
51 |
} |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
52 |
|
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
53 |
sub Module() |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
54 |
{ |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
55 |
my $self = shift; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
56 |
$self->{iModule} = $_[0] if $_[0]; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
57 |
return $self->{iModule}; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
58 |
} |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
59 |
|
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
60 |
sub Severity() |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
61 |
{ |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
62 |
my $self = shift; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
63 |
$self->{iSeverity} = $_[0] if $_[0]; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
64 |
return $self->{iSeverity}; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
65 |
} |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
66 |
|
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
67 |
sub Depth() |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
68 |
{ |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
69 |
my $self = shift; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
70 |
$self->{iDepth} = $_[0] if $_[0]; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
71 |
return $self->{iDepth}; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
72 |
} |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
73 |
|
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
74 |
sub Date() |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
75 |
{ |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
76 |
my $self = shift; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
77 |
$self->{iDate} = $_[0] if $_[0]; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
78 |
return $self->{iDate}; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
79 |
} |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
80 |
|
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
81 |
sub Code() |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
82 |
{ |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
83 |
my $self = shift; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
84 |
$self->{iCode} = $_[0] if $_[0]; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
85 |
return $self->{iCode}; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
86 |
} |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
87 |
|
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
88 |
sub LogText() |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
89 |
{ |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
90 |
my $self = shift; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
91 |
return $self->SeverityText()."(".$self->{iCode}.") [".$self->{iDate}."]: "." " x $self->{iDepth}.$self->{iMessage}."\n"; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
92 |
} |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
93 |
|
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
94 |
sub SeverityText() |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
95 |
{ |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
96 |
my $self = shift; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
97 |
return " ERROR" if $self->Severity() == DepConstants::ERROR; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
98 |
return "WARNING" if $self->Severity() == DepConstants::WARNING; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
99 |
return " INFO"; |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
100 |
} |
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
101 |
|
b538b70cbe51
Move rest of the swconfigmdw package components to oss repository.
terytkon
parents:
diff
changeset
|
102 |
1; |