This file is indexed.

/usr/share/perl5/Device/Modem/Log/Syslog.pm is in libdevice-modem-perl 1.47-2.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# Device::Modem::Log::Syslog - Syslog logging plugin for Device::Modem class
#
# Copyright (C) 2002-2004 Cosimo Streppone, cosimo@cpan.org
#
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
#
# Additionally, this is ALPHA software, still needs extensive
# testing and support for generic AT commads, so use it at your own risk,
# and without ANY warranty! Have fun.
#
# $Id: Syslog.pm,v 2.1 2004/11/10 09:12:14 cosimo Exp $

package Device::Modem::Log::Syslog;
$VERSION = sprintf '%d.%02d', q$Revision: 2.1 $ =~ /(\d+)\.(\d+)/;

use strict;
use Sys::Syslog ();

sub new {
	my($class, $package) = @_;
	Sys::Syslog::setlogsock('unix');
	Sys::Syslog::openlog($package, 'cons,pid', 'user');
	my $loglevel = 'info';
	bless \$loglevel, 'Device::Modem::Log::Syslog';
}

{

# Define log levels like syslog service
my %levels = ( debug => 7, info => 6, notice => 5, warning => 4, err => 3, crit => 2, alert => 1, emerg => 0 );

sub loglevel {
	my($self, $newlevel) = @_;

	if( defined $newlevel ) {
		$newlevel = lc $newlevel;
		if( $newlevel eq 'verbose' ) {
			$newlevel = 'info';
		}
		if( ! exists $levels{$newlevel} ) {
			$newlevel = 'notice';
		}
		$$self = $newlevel;

		# Set new logmask
		my $logmask = 0xFF; #(1 << ($levels{$newlevel} + 1)) - 1;
		Sys::Syslog::setlogmask( $logmask );

	} else {

		return $$self;

	}
}

sub write($$) {
	my($self, $level, @msg) = @_;
	Sys::Syslog::syslog( $level, @msg );
	return 1;
}

}

sub close {
	my $self = shift();
	Sys::Syslog::closelog();
}


1;

__END__

=head1 NAME

Device::Modem::Log::Syslog - Syslog logging plugin for Device::Modem class

=head1 SYNOPSIS

  use Device::Modem;

  my $box = new Device::Modem( log => 'syslog', ... );
  ...

=head1 DESCRIPTION

Example log class for B<Device::Modem> that logs all
modem activity, commands, ... to B<syslog>

It is loaded automatically at B<Device::Modem> startup,
only if you specify C<syslog> value to C<log> parameter.

If you don't have B<Sys::Syslog> additional module installed,
you will not be able to use this logging plugin, and you should
better leave the default logging (to text file).

=head2 REQUIRES

C<Sys::Syslog>

=head2 EXPORTS

None

=head1 AUTHOR

Cosimo Streppone, cosimo@cpan.org

=head1 COPYRIGHT

(C) 2002 Cosimo Streppone, cosimo@cpan.org

This library is free software; you can only redistribute it and/or
modify it under the same terms as Perl itself.

=head1 SEE ALSO

C<Device::Modem>
C<Device::Modem::Log::File>

=cut