1Mojo::Log(3)          User Contributed Perl Documentation         Mojo::Log(3)
2
3
4

NAME

6       Mojo::Log - Simple Logger For Mojo
7

SYNOPSIS

9           use Mojo::Log;
10
11           # Create a logging object that will log to STDERR by default
12           my $log = Mojo::Log->new;
13
14           # Customize the log location and minimum log level
15           my $log = Mojo::Log->new(
16               path  => '/var/log/mojo.log',
17               level => 'warn',
18           );
19
20           $log->debug("Why isn't this working?");
21           $log->info("FYI: it happened again");
22           $log->warn("This might be a problem");
23           $log->error("Garden variety error");
24           $log->fatal("Boom!");
25

DESCRIPTION

27       Mojo::Log is a simple logger for Mojo projects.
28

ATTRIBUTES

30       Mojo::Log implements the following attributes.
31
32   "handle"
33           my $handle = $log->handle;
34           $log       = $log->handle(IO::File->new);
35
36       Logfile handle.
37
38   "level"
39           my $level = $log->level;
40           $log      = $log->level('debug');
41
42       Log level.
43
44   "path"
45           my $path = $log->path
46           $log     = $log->path('/var/log/mojo.log');
47
48       Logfile path.
49

METHODS

51       Mojo::Log inherits all methods from Mojo::Base and implements the
52       following new ones.
53
54   "debug"
55           $log = $log->debug('You screwed up, but thats ok');
56
57       Log debug message.
58
59   "error"
60           $log = $log->error('You really screwed up this time');
61
62       Log error message.
63
64   "fatal"
65           $log = $log->fatal('Its over...');
66
67       Log fatal message.
68
69   "info"
70           $log = $log->info('You are bad, but you prolly know already');
71
72       Log info message.
73
74   "is_level"
75           my $is = $log->is_level('debug');
76
77       Check log level.
78
79   "is_debug"
80           my $is = $log->is_debug;
81
82       Check for debug log level.
83
84   "is_error"
85           my $is = $log->is_error;
86
87       Check for error log level.
88
89   "is_fatal"
90           my $is = $log->is_fatal;
91
92       Check for fatal log level.
93
94   "is_info"
95           my $is = $log->is_info;
96
97       Check for info log level.
98
99   "is_warn"
100           my $is = $log->is_warn;
101
102       Check for warn log level.
103
104   "log"
105           $log = $log->log(debug => 'This should work');
106
107       Log a message.
108
109   "warn"
110           $log = $log->warn('Dont do that Dave...');
111
112       Log warn message.
113

SEE ALSO

115       Mojolicious, Mojolicious::Guides, <http://mojolicious.org>.
116
117
118
119perl v5.12.3                      2010-08-12                      Mojo::Log(3)
Impressum