Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging::write() custom levels being converted to int #1863

Open
casperwilkes opened this issue Apr 28, 2015 · 2 comments
Open

Logging::write() custom levels being converted to int #1863

casperwilkes opened this issue Apr 28, 2015 · 2 comments

Comments

@casperwilkes
Copy link

In the documentation it states that you can use Log::write() to create you're own custom levels to log at.

// and finally, we create a log entry with a custom $level
Log::write('Link', 'More info on http://fuelphp.com/')

This does not work as of the current version. Currently, it's taking your custom level, checking against an array of predefined settings, if not found, and converting it to a notice. If you use leave the default threshold where it's set in the config file, the NOTICE threshold is too small, thus not getting logged.

This kind of defeats the purpose if you want to use your own levels. If you lower the threshold as a work around, you get a lot of unnecessary logging going on from the router class.

Please see: Fuel/Core/Classes/Log.php line 222:

if (is_string($level))
        {
            if ( ! $level = array_search($level, static::$levels))
            {
                $level = 250;   // can't map it, convert it to a NOTICE
            }
        }
@WanWizard
Copy link
Member

I think that no longer works since we've switched to Monolog in v1.5, which uses fixed levels. We'll have to see how to retain this feature.

Seldaek/monolog#103 suggests it will not be that simple.

@casperwilkes
Copy link
Author

Yeah, I was looking around the file for a way to implement it. I ended up just lowering the threshold and commenting out the logging in the router class. That seems to work if you use the predefined Log Methods or pass the predefined constants to Log::write().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants