mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-24 06:32:06 +08:00
Added example of user defined class with operator<<
This commit is contained in:
parent
386f75200d
commit
a7b2828582
13
README.md
13
README.md
@ -136,4 +136,17 @@ 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 << "..";
|
||||||
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user