FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
php-cli/examples/logging.php at dynamicLogLevel · splitbrain/php-cli · GitHub
splitbrain
/
php-cli
Public
Notifications
You must be signed in to change notification settings
Fork
40
Star
179
Code
Issues
1
Pull requests
1
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
php-cli
/
examples
/
logging.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
37 lines (32 loc) · 1.09 KB
Breadcrumbs
php-cli
/
examples
/
logging.php
Copy path
File metadata and controls
executable file
·
37 lines (32 loc) · 1.09 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#!/usr/bin/php
<?php
require
__DIR__
.
'
/../vendor/autoload.php
'
;
use
splitbrain
\
phpcli
\
CLI
;
use
splitbrain
\
phpcli
\
Options
;
class
logging
extends
CLI
// you may want to extend from PSR3CLI instead
{
// override the default log level
protected
$
logdefault
=
'
debug
'
;
// register options and arguments
protected
function
setup
(
Options
$
options
)
{
$
options
->
setHelp
(
'
A very minimal example that demos the logging
'
);
}
// implement your code
protected
function
main
(
Options
$
options
)
{
$
this
->
debug
(
'
This is a debug message
'
);
$
this
->
info
(
'
This is a info message
'
);
$
this
->
notice
(
'
This is a notice message
'
);
$
this
->
success
(
'
This is a success message
'
);
$
this
->
warning
(
'
This is a warning message
'
);
$
this
->
error
(
'
This is a error message
'
);
$
this
->
critical
(
'
This is a critical message
'
);
$
this
->
alert
(
'
This is a alert message
'
);
$
this
->
emergency
(
'
This is a emergency message
'
);
throw
new
\
Exception
(
'
Exception will be caught, too
'
);
}
}
// execute it
$
cli
=
new
logging
();
$
cli
->
run
();
Back
|
FazBrowse Home
|
New Git URL