The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Log::FreeSWITCH::Line::Data - Data object which represents FreeSWITCH log line.

SYNOPSIS

use Log::FreeSWITCH::Line::Data;

my $obj = Log::FreeSWITCH::Line::Data->new(%params);
my $date = $obj->date;
my $datetime_o = $obj->datetime_obj;
my $file = $obj->file;
my $file_line = $obj->file_line;
my $message = $obj->message;
my $raw = $obj->raw($raw);
my $time = $obj->time;
my $type = $obj->type;

METHODS

new

my $obj = Log::FreeSWITCH::Line::Data->new(%params);

Constructor.

Returns instance of object.

  • date

    Date of log entry.
    Format of date is 'YYYY-MM-DD'.
    It is required.
  • file

    File in log entry.
    It is required.
  • file_line

    File line in log entry.
    It is required.
  • message

    Log message.
  • raw

    Raw FreeSWITCH log entry.
  • time

    Time of log entry.
    Format of time is 'HH:MM:SS'.
    It is required.
  • type

    Type of log entry.
    It is required.

date

my $date = $obj->date;

Get log entry date.

Returns string with date in 'YYYY-MM-DD' format.

datetime_obj

my $datetime_o = $obj->datetime_obj;

Get DateTime object.

Returns DateTime object.

file

my $file = $obj->file;

Get file in log entry.

Returns string.

file_line

my $file_line = $obj->file_line;

Get file line in log entry.

Returns string.

message

my $message = $obj->message;

Get log message.

Returns string.

raw

my $raw = $obj->raw($raw);

Get or set raw FreeSWITCH log entry.

Returns string.

time

my $time = $obj->time;

Get log entry time.

Returns string with time in 'HH:MM:SS' format.

type

my $type = $obj->type;

Get log entry type.

Returns string.

ERRORS

new():
        date required
        file required
        file_line required
        time required
        type required

datetime_obj():
        Cannot create DateTime object.
                Error: %s
        Cannot load 'DateTime' class.
                Error: %s

EXAMPLE

use strict;
use warnings;

use Log::FreeSWITCH::Line::Data;

# Object.
my $data_o = Log::FreeSWITCH::Line::Data->new(
        'date' => '2014-07-01',
        'file' => 'sofia.c',
        'file_line' => 4045,
        'message' => 'inbound-codec-prefs [PCMA]',
        'time' => '13:37:53.973562',
        'type' => 'DEBUG',
);

# Print out informations.
print 'Date: '.$data_o->date."\n";

# Output:
# Date: 2014-07-01

DEPENDENCIES

DateTime, English, Error::Pure::Always, Error::Pure, Mo.

SEE ALSO

Log::FreeSWITCH::Line

FreeSWITCH log line parsing and serializing.

REPOSITORY

https://github.com/michal-josef-spacek/Log-FreeSWITCH-Line

AUTHOR

Michal Josef Špaček mailto:skim@cpan.org

http://skim.cz

LICENSE AND COPYRIGHT

© 2014-2022 Michal Josef Špaček

BSD 2-Clause License

VERSION

0.08