- Timestamp:
- Aug 16, 2017, 12:53:41 PM (7 years ago)
- Branches:
- master
- Children:
- da7341e
- Parents:
- a619eda
- git-author:
- Jason Gross <jgross@mit.edu> (07/12/11 12:34:46)
- git-committer:
- Jason Gross <jasongross9@gmail.com> (08/16/17 12:53:41)
- Location:
- perl/lib/BarnOwl
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/lib/BarnOwl/Message.pm
r0adbce1 r7f463cf 115 115 } 116 116 return $s; 117 } 118 119 =head2 log MESSAGE 120 121 Returns the text that should be written to a file to log C<MESSAGE>. 122 123 =cut 124 125 sub log { 126 my ($m) = @_; 127 return $m->log_header . "\n\n" . $m->log_body . "\n\n"; 128 } 129 130 =head2 log_header MESSAGE 131 132 Returns the header of the message, for logging purposes. 133 If you override L<BarnOwl::Message::log>, this method is not called. 134 135 =cut 136 137 sub log_header { 138 my ($m) = @_; 139 my $sender = $m->sender; 140 my $recipient = $m->recipient; 141 my $timestr = $m->time; 142 return "From: <$sender> To: <$recipient>\n" 143 . "Time: $timestr"; 144 } 145 146 =head2 log_body MESSAGE 147 148 Returns the body of the message, for logging purposes. 149 If you override L<BarnOwl::Message::log>, this method is not called. 150 151 =cut 152 153 sub log_body { 154 my ($m) = @_; 155 if ($m->is_loginout) { 156 return uc($m->login) 157 . $m->login_type 158 . ($m->login_extra ? ' at ' . $m->login_extra : ''); 159 } else { 160 return $m->body; 161 } 117 162 } 118 163 -
perl/lib/BarnOwl/Message/Zephyr.pm
r0adbce1 r7f463cf 223 223 } 224 224 225 # Logging 226 sub log_header { 227 my ($m) = @_; 228 my $class = $m->class; 229 my $instance = $m->instance; 230 my $opcode = $m->opcode; 231 my $timestr = $m->time; 232 my $host = $m->host; 233 my $sender = $m->pretty_sender; 234 my $zsig = $m->zsig; 235 my $rtn = "Class: $class Instance: $instance"; 236 $rtn .= " Opcode: $opcode" unless !defined $opcode || $opcode eq ''; 237 $rtn .= "\nTime: $timestr Host: $host" 238 . "\nFrom: $zsig <$sender>"; 239 return $rtn; 240 } 225 241 226 242 1;
Note: See TracChangeset
for help on using the changeset viewer.