billiam105 / log4cr Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
After bugtesting this issue is not one.
As an example of the confusing behavior, see the following failing spec.
Note: as a workaround, you can set the level of the root (or offending) Appender
to the same as it's Logger
.
it "logs from child loggers but not from parents in the correct circumstances" do
# root logger setup
io = IO::Memory.new
root_appender = Log4cr::Appender.new io
root_appender.formatter = Logger::Formatter.new do |severity, datetime, progname, message, io|
io << "[ROOT] " << message
end
Log4cr::Logger.root_logger.add_appender root_appender
Log4cr::Logger.root_logger.level = ::Logger::INFO
# child logger setup
child_appender = Log4cr::Appender.new io
child_appender.formatter = Logger::Formatter.new do |severity, datetime, progname, message, io|
io << "[CHILD] " << message
end
Log4cr::Logger.get("base.special").add_appender child_appender
Log4cr::Logger.get("base.special").level = ::Logger::DEBUG
# logging
Log4cr::Logger.root_logger.info("this should log to root")
Log4cr::Logger.root_logger.debug("this should not log to anything")
Log4cr::Logger.get("base").info("this should log to root again")
Log4cr::Logger.get("base").debug("this should also not log to anything")
Log4cr::Logger.get("base.special").debug("this should log to child but not root")
Log4cr::Logger.get("base.special").info("this should log to child AND root")
# expectation
io.to_s.should eq <<-END
[ROOT] this should log to root
[ROOT] this should log to root again
[CHILD] this should log to child but not root
[CHILD] this should log to child AND root
[ROOT] this should log to child AND root\n
END
end
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.