This repository was archived by the owner on Dec 8, 2022. It is now read-only.
forked from mako-framework/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Learn more: Logging
Marco Montalbano edited this page Jul 31, 2017
·
1 revision
The log class provides a simple and consistent interface to the most common (and some uncommon) logging solutions:
- DebugToolbar
- File
- FirePHP
- Syslog
To get an instance of the default logger just call the instance method of the log class. If you want to get an instance of any of the other logger configurations defined in the config file then you'll have to pass the configuration name as the first argument to the instance method.
// Returns instance of the "default" logger configuration defined in the config file
$log = Log::instance();
// Returns instance of the "syslog" log configuration defined in the config file
$log = Log::instance('syslog');
To write something to the log use the write method. The method returns TRUE on success or FALSE on failure.
// Writes "Hello, world!" to the log
$log->write('Hello, world!');
// Writes "Hello, world!" to the log treating it as a debug message
$log->write('Hello, world!', Log::DEBUG);
// You can also use the magic shortcut methods for writing to the default instance
Log::debug('Hello, world!');
The available log types are Log::EMERGENCY, Log::ALERT, Log::CRITICAL, Log::ERROR, Log::WARNING, Log::NOTICE, Log::INFO and Log::DEBUG.
- Getting started: Installation
- Getting started: Configuration
- Getting started: Error handling
- Getting started: Constants
- Getting started: Coding standards
- Controllers: Controllers
- Controllers: Request
- Controllers: Response
- Databases: Basics
- Databases: Query builder
- Databases: Orm
- Databases: Migrations
- Command line: Basics
- Command line: Custom tasks
- Packages: Basics
- Packages: Composer packages
- Learn more: Array helper
- Learn more: Asset manager
- Learn more: Autoloading
- Learn more: Caching
- Learn more: Cookies
- Learn more: Events
- Learn more: File helper
- Learn more: Html helper
- Learn more: Internationalization
- Learn more: Logging
- Learn more: Number helper
- Learn more: Pagination
- Learn more: Redis client
- Learn more: Rest client
- Learn more: Security helpers
- Learn more: Sessions
- Learn more: String helper
- Learn more: Url helper
- Learn more: Uuid helper
- Learn more: Validation
- Learn more: Views