[GH-ISSUE #103] Can i have custom Levels in monolog #34

Closed
opened 2026-03-04 02:11:33 +03:00 by kerem · 3 comments
Owner

Originally created by @ghost on GitHub (Aug 14, 2012).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/103

Currently i am using custom entity manager to write my logs
But i only want to log those things which i manually want to log.

logger1:
type: stream
path: /var/log/file1.log
level: MY_CUSTOM_LEVEL

logger1:
type: stream
path: /var/log/file2.log
level: MY_CUSTOM_LEVEL2

$logger.log("This is for level 1","MY_CUSTOM_LEVEL")

Originally created by @ghost on GitHub (Aug 14, 2012). Original GitHub issue: https://github.com/Seldaek/monolog/issues/103 Currently i am using custom entity manager to write my logs But i only want to log those things which i manually want to log. logger1: type: stream path: /var/log/file1.log level: MY_CUSTOM_LEVEL logger1: type: stream path: /var/log/file2.log level: MY_CUSTOM_LEVEL2 $logger.log("This is for level 1","MY_CUSTOM_LEVEL")
kerem closed this issue 2026-03-04 02:11:33 +03:00
Author
Owner

@Seldaek commented on GitHub (Aug 14, 2012):

If you want a custom log with only some information, why not create a new logger/handler that you pass to the code that logs this custom information? Custom log levels are not supported, and while it's doable by extending a few classes, it's not a recommended way to do things.

<!-- gh-comment-id:7722402 --> @Seldaek commented on GitHub (Aug 14, 2012): If you want a custom log with only some information, why not create a new logger/handler that you pass to the code that logs this custom information? Custom log levels are not supported, and while it's doable by extending a few classes, it's not a recommended way to do things.
Author
Owner

@ghost commented on GitHub (Aug 14, 2012):

I have created a new handler as you have said in extending monolog. That is inserting into database. But how can i create new logger as you have said

<!-- gh-comment-id:7724499 --> @ghost commented on GitHub (Aug 14, 2012): I have created a new handler as you have said in extending monolog. That is inserting into database. But how can i create new logger as you have said
Author
Owner

@Seldaek commented on GitHub (Aug 14, 2012):

$logger = new Logger();
$logger->pushHandler(new DbHandler());
<!-- gh-comment-id:7724646 --> @Seldaek commented on GitHub (Aug 14, 2012): ``` $logger = new Logger(); $logger->pushHandler(new DbHandler()); ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/monolog#34
No description provided.