Model/Database/Messaging/Result/Log.pm

filter: Statementstmt 33.3% 1 / 3 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 1 / 1 Podpod n/a totaltotal 50.0% 2 / 4 CC 1 SCAR 2.6
CC
1
Cov
33%
BEGIN
1.3
CRAP 1.3
« Model/Database/Messaging/Result/Alert.pm ↑ Summary Collector/Format/Base.pm »
1 package XAS::Model::Database::Messaging::Result::Log;
2  
3 our $VERSION = '0.01';
4  
5 use XAS::Class
6 0 ▶ version => $VERSION,
Subroutine BEGIN: called CC=1 SCAR=2.6
7 base => 'DBIx::Class::Core',
8 mixin => 'XAS::Model::DBM'
9 1 ;
10  
11 __PACKAGE__->load_components( qw/ InflateColumn::DateTime OptimisticLocking / );
12 __PACKAGE__->table( 'log' );
13 __PACKAGE__->add_columns(
14 id => {
15 data_type => 'bigint',
16 is_auto_increment => 1,
17 sequence => 'log_id_seq',
18 is_nullable => 0
19 },
20 hostname => {
21 data_type => 'varchar',
22 size => 254,
23 is_nullable => 0
24 },
25 datetime => {
26 data_type => 'timestamp with time zone',
27 timezone => 'local',
28 is_nullable => 0
29 },
30 type => {
31 data_type => 'varchar',
32 size => 32,
33 is_nullable => 0
34 },
35 level => {
36 data_type => 'varchar',
37 size => 32,
38 is_nullable => 0
39 },
40 facility => {
41 data_type => 'varchar',
42 size => 32,
43 is_nullable => 0
44 },
45 process => {
46 data_type => 'varchar',
47 size => 32,
48 is_nullable => 0
49 },
50 message => {
51 data_type => 'varchar',
52 size => 256,
53 is_nullable => 0
54 },
55 pid => {
56 data_type => 'varchar',
57 size => 16,
58 is_nullable => 0
59 },
60 tid => {
61 data_type => 'varchar',
62 size => 32,
63 is_nullable => 0
64 },
65 msgnum => {
66 data_type => 'varchar',
67 size => 16,
68 is_nullable => 0
69 },
70 revision => {
71 data_type => 'integer',
72 is_nullable => 1
73 }
74 );
75  
76 __PACKAGE__->set_primary_key( 'id' );
77 __PACKAGE__->optimistic_locking_strategy('version');
78 __PACKAGE__->optimistic_locking_version_column('revision');
79  
80 sub sqlt_deploy_hook {
81 my ($self, $sqlt_table) = @_;
82  
83 $sqlt_table->add_index(name => 'log_hostname_idx', fields => ['hostname']);
84 $sqlt_table->add_index(name => 'log_datetime_idx', fields => ['datetime']);
85 $sqlt_table->add_index(name => 'log_type_idx', fields => ['type']);
86 $sqlt_table->add_index(name => 'log_level_idx', fields => ['level']);
87 $sqlt_table->add_index(name => 'log_facility_idx', fields => ['facility']);
88 $sqlt_table->add_index(name => 'log_process_idx', fields => ['process']);
89  
90 }
91  
92 sub table_name {
93 return __PACKAGE__;
94 }
95  
96 1;
97  
98 __END__
99
100 =head1 NAME
101  
102 XAS::Model::Database::Messaging::Result::Log - Table for XAS Log entries
103  
104 =head1 DESCRIPTION
105  
106 The definition for the log table.
107  
108 =head1 FIELDS
109  
110 =head2 id
111  
112 An automatic incremental index.
113  
114 =over 4
115  
116 =item B<data type> - bigint
117  
118 =item B<is nullable> - no
119  
120 =back
121  
122 =head2 hostname
123  
124 The name of the host that the entry is from.
125  
126 =over 4
127  
128 =item B<data type> - varchar
129
130 =item B<size> - 254
131  
132 =item B<is nullable> - no
133  
134 =back
135  
136 =head2 datetime
137  
138 The date and time when the record was created.
139  
140 =over 4
141  
142 =item B<data type> - timestamp with time zone
143
144 =item B<timezone> - local
145  
146 =item B<is nullable> - no
147  
148 =back
149  
150 =head2 level
151  
152 The level of the alert.
153  
154 =over 4
155  
156 =item B<data type> - varchar
157
158 =item B<size> - 32
159  
160 =item B<is nullable> - no
161  
162 =back
163  
164 =head2 facility
165  
166 The facility of the alert.
167  
168 =over 4
169  
170 =item B<data type> - varchar
171
172 =item B<size> - 32
173  
174 =item B<is nullable> - no
175  
176 =back
177  
178 =head2 process
179  
180 The name of the process that generated the alert.
181  
182 =over 4
183  
184 =item B<data type> - varchar
185
186 =item B<size> - 32
187  
188 =item B<is nullable> - no
189  
190 =back
191  
192 =head2 message
193  
194 The message.
195  
196 =over 4
197  
198 =item B<data type> - varchar
199
200 =item B<size> - 256
201  
202 =item B<is nullable> - no
203  
204 =back
205  
206 =head2 pid
207  
208 The process id of process that generated the alert.
209  
210 =over 4
211  
212 =item B<data type> - varchar
213
214 =item B<size> - 16
215  
216 =item B<is nullable> - no
217  
218 =back
219  
220 =head2 tid
221  
222 The id for the thread of the process that generated the alert.
223  
224 =over 4
225  
226 =item B<data type> - varchar
227
228 =item B<size> - 32
229  
230 =item B<is nullable> - no
231  
232 =back
233  
234 =head2 msgnum
235  
236 The message number of the message for the alert.
237  
238 =over 4
239  
240 =item B<data type> - varchar
241
242 =item B<size> - 16
243  
244 =item B<is nullable> - no
245  
246 =back
247  
248 =head2 revision
249  
250 Used by L<DBIx::Class::OptimisticLocking|https://metacpan.org/pod/DBIx::Class::Optimisticlocking>
251 to manage changes for this record.
252  
253 =over 4
254  
255 =item B<data type> - integer
256
257 =item B<is nullable> - yes
258  
259 =back
260  
261 =head1 METHODS
262  
263 =head2 sqlt_deploy_hook($sqlt_table)
264  
265 This method is used when a database schema is being generated. It can be used
266 to add additional features.
267  
268 =over 4
269  
270 =item B<$sqlt_table>
271  
272 The DBIx::Class class for this table.
273  
274 =back
275  
276 =head2 table_name
277  
278 Used by the helper functions mixed in from L<XAS::Model::DBM|XAS::Model::DBM>.
279  
280 =head1 SEE ALSO
281  
282 =over 4
283  
284 =item L<XAS::Collector|XAS::Collector>
285  
286 =item L<XAS|XAS>
287  
288 =back
289  
290 =head1 AUTHOR
291  
292 Kevin L. Esteb, <kevin@kesteb.us>
293  
294 =head1 COPYRIGHT AND LICENSE
295  
296 Copyright (c) 2015 Kevin L. Esteb
297  
298 This is free software; you can redistribute it and/or modify it under
299 the terms of the Artistic License 2.0. For details, see the full text
300 of the license at http://www.perlfoundation.org/artistic_license_2_0.
301  
302 =cut
« Model/Database/Messaging/Result/Alert.pm ↑ Summary Collector/Format/Base.pm »