Added example of user defined class with operator<<

This commit is contained in:
Gabi Melman 2015-01-28 13:37:38 +02:00
parent 297cbc1ffc
commit 386f75200d

View File

@ -88,3 +88,18 @@ int main(int, char* [])
std::cout << "Log failed: " << ex.what() << std::endl; std::cout << "Log failed: " << ex.what() << std::endl;
} }
} }
//
// Example of user defined class with operator<<
//
class some_class {};
std::ostream& operator<<(std::ostream& os, const some_class& c) { return os << "some_class"; }
void custom_class_example()
{
some_class c;
spdlog::get("console")->info("custom class with operator<<: {}", c);
spdlog::get("console")->info() << "custom class with operator<<: " << c;
}