Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $user= User::find($user_id);
- Log::info(print_r($user, true));
- <?php
- $user = User::find($user_id);
- Log::error("Something happened to User {$user_id}.", ['object' => $user->toJson()]);
- <?php
- // User.php
- [...]
- class User
- {
- [...]
- public function __toString()
- {
- return "{$this->id}";
- }
- }
- // [...]
- $user = User::find($user_id);
- Log::error("Something happened to User {$user}.", ['object' => $user->toJson()]);
- Log::debug((array) $object);
- /**
- * Format the parameters for the logger.
- *
- * @param mixed $message
- * @return mixed
- */
- protected function formatMessage($message)
- {
- if (is_array($message)) {
- return var_export($message, true);
- } elseif ($message instanceof Jsonable) {
- return $message->toJson();
- } elseif ($message instanceof Arrayable) {
- return var_export($message->toArray(), true);
- }
- return $message;
- }
- Log::emergency($message);
- Log::alert($message);
- Log::critical($message);
- Log::error($message);
- Log::warning($message);
- Log::notice($message);
- Log::info($message);
- Log::debug($message);
Add Comment
Please, Sign In to add comment