]> git.lizzy.rs Git - irrlicht.git/commitdiff
Unify & improve log messages
authorcutealien <cutealien@dfc29bdd-3216-0410-991c-e03cc46cb475>
Thu, 30 Jun 2022 16:23:48 +0000 (16:23 +0000)
committersfan5 <sfan5@live.de>
Fri, 24 Mar 2023 16:09:11 +0000 (17:09 +0100)
Lots of places where coders did not realize our Printer::log with hint adds a ": " string between message and hint
Which caused uglier messages in a few places (added documentation for that, maybe helps?)
Some added info in a few places
Some whitespace unification
Some spelling unification

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6414 dfc29bdd-3216-0410-991c-e03cc46cb475

source/Irrlicht/CImageLoaderPNG.cpp
source/Irrlicht/CImageLoaderTGA.cpp
source/Irrlicht/CImageWriterPNG.cpp
source/Irrlicht/CIrrDeviceLinux.cpp
source/Irrlicht/CIrrDeviceSDL.cpp
source/Irrlicht/COBJMeshFileLoader.cpp
source/Irrlicht/CSkinnedMesh.cpp
source/Irrlicht/CWGLManager.cpp
source/Irrlicht/CXMeshFileLoader.cpp
source/Irrlicht/os.h

index 59709bfb788440b695c4e60dd3d25d93d4c8356d..665634c1cbbfde365f027ef3bd9dddad7be2421d 100644 (file)
@@ -80,14 +80,14 @@ IImage* CImageLoaderPng::loadImage(io::IReadFile* file) const
        // Read the first few bytes of the PNG file\r
        if( file->read(buffer, 8) != 8 )\r
        {\r
-               os::Printer::log("LOAD PNG: can't read file\n", file->getFileName(), ELL_ERROR);\r
+               os::Printer::log("LOAD PNG: can't read file (filesize < 8)", file->getFileName(), ELL_ERROR);\r
                return 0;\r
        }\r
 \r
        // Check if it really is a PNG file\r
        if( png_sig_cmp(buffer, 0, 8) )\r
        {\r
-               os::Printer::log("LOAD PNG: not really a png\n", file->getFileName(), ELL_ERROR);\r
+               os::Printer::log("LOAD PNG: not really a png (wrong signature)", file->getFileName(), ELL_ERROR);\r
                return 0;\r
        }\r
 \r
@@ -96,7 +96,7 @@ IImage* CImageLoaderPng::loadImage(io::IReadFile* file) const
                NULL, (png_error_ptr)png_cpexcept_error, (png_error_ptr)png_cpexcept_warn);\r
        if (!png_ptr)\r
        {\r
-               os::Printer::log("LOAD PNG: Internal PNG create read struct failure\n", file->getFileName(), ELL_ERROR);\r
+               os::Printer::log("LOAD PNG: Internal PNG create read struct failure", file->getFileName(), ELL_ERROR);\r
                return 0;\r
        }\r
 \r
@@ -104,7 +104,7 @@ IImage* CImageLoaderPng::loadImage(io::IReadFile* file) const
        png_infop info_ptr = png_create_info_struct(png_ptr);\r
        if (!info_ptr)\r
        {\r
-               os::Printer::log("LOAD PNG: Internal PNG create info struct failure\n", file->getFileName(), ELL_ERROR);\r
+               os::Printer::log("LOAD PNG: Internal PNG create info struct failure", file->getFileName(), ELL_ERROR);\r
                png_destroy_read_struct(&png_ptr, NULL, NULL);\r
                return 0;\r
        }\r
@@ -212,7 +212,7 @@ IImage* CImageLoaderPng::loadImage(io::IReadFile* file) const
                image = new CImage(ECF_R8G8B8, core::dimension2d<u32>(Width, Height));\r
        if (!image)\r
        {\r
-               os::Printer::log("LOAD PNG: Internal PNG create image struct failure\n", file->getFileName(), ELL_ERROR);\r
+               os::Printer::log("LOAD PNG: Internal PNG create image struct failure", file->getFileName(), ELL_ERROR);\r
                png_destroy_read_struct(&png_ptr, NULL, NULL);\r
                return 0;\r
        }\r
@@ -221,7 +221,7 @@ IImage* CImageLoaderPng::loadImage(io::IReadFile* file) const
        RowPointers = new png_bytep[Height];\r
        if (!RowPointers)\r
        {\r
-               os::Printer::log("LOAD PNG: Internal PNG create row pointers failure\n", file->getFileName(), ELL_ERROR);\r
+               os::Printer::log("LOAD PNG: Internal PNG create row pointers failure", file->getFileName(), ELL_ERROR);\r
                png_destroy_read_struct(&png_ptr, NULL, NULL);\r
                delete image;\r
                return 0;\r
index 3286bddd6c89415a11fca28e3c4db89ef536d7fd..d5e24a584ce16f4829aea7687e6c41d849f41a49 100644 (file)
@@ -106,7 +106,7 @@ IImage* CImageLoaderTGA::loadImage(io::IReadFile* file) const
 \r
        if (!checkImageDimensions(header.ImageWidth, header.ImageHeight))\r
        {\r
-               os::Printer::log("Rejecting TGA with unreasonable size.", ELL_ERROR);\r
+               os::Printer::log("Image dimensions too large in file", file->getFileName(), ELL_ERROR);\r
                return 0;\r
        }\r
 \r
index 0e2a71ecf77f39267206319a9e87ebb63b527f1b..2f5260a89e53955dd5b231c7099c30a300a842d7 100644 (file)
@@ -69,7 +69,7 @@ bool CImageWriterPNG::writeImage(io::IWriteFile* file, IImage* image,u32 param)
                NULL, (png_error_ptr)png_cpexcept_error, (png_error_ptr)png_cpexcept_warning);\r
        if (!png_ptr)\r
        {\r
-               os::Printer::log("PNGWriter: Internal PNG create write struct failure\n", file->getFileName(), ELL_ERROR);\r
+               os::Printer::log("PNGWriter: Internal PNG create write struct failure", file->getFileName(), ELL_ERROR);\r
                return false;\r
        }\r
 \r
@@ -77,7 +77,7 @@ bool CImageWriterPNG::writeImage(io::IWriteFile* file, IImage* image,u32 param)
        png_infop info_ptr = png_create_info_struct(png_ptr);\r
        if (!info_ptr)\r
        {\r
-               os::Printer::log("PNGWriter: Internal PNG create info struct failure\n", file->getFileName(), ELL_ERROR);\r
+               os::Printer::log("PNGWriter: Internal PNG create info struct failure", file->getFileName(), ELL_ERROR);\r
                png_destroy_write_struct(&png_ptr, NULL);\r
                return false;\r
        }\r
@@ -126,7 +126,7 @@ bool CImageWriterPNG::writeImage(io::IWriteFile* file, IImage* image,u32 param)
        u8* tmpImage = new u8[image->getDimension().Height*lineWidth];\r
        if (!tmpImage)\r
        {\r
-               os::Printer::log("PNGWriter: Internal PNG create image failure\n", file->getFileName(), ELL_ERROR);\r
+               os::Printer::log("PNGWriter: Internal PNG create image failure", file->getFileName(), ELL_ERROR);\r
                png_destroy_write_struct(&png_ptr, &info_ptr);\r
                return false;\r
        }\r
@@ -160,7 +160,7 @@ bool CImageWriterPNG::writeImage(io::IWriteFile* file, IImage* image,u32 param)
        u8** RowPointers = new png_bytep[image->getDimension().Height];\r
        if (!RowPointers)\r
        {\r
-               os::Printer::log("PNGWriter: Internal PNG create row pointers failure\n", file->getFileName(), ELL_ERROR);\r
+               os::Printer::log("PNGWriter: Internal PNG create row pointers failure", file->getFileName(), ELL_ERROR);\r
                png_destroy_write_struct(&png_ptr, &info_ptr);\r
                delete [] tmpImage;\r
                return false;\r
index b447015bcac4d8978f3a6af847d657b80649006c..3c1909917f4b5a25b53340b6ef1b516dde0ee738 100644 (file)
@@ -287,26 +287,26 @@ void IrrPrintXGrabError(int grabResult, const c8 * grabCommand )
 {\r
        if ( grabResult == GrabSuccess )\r
        {\r
-//             os::Printer::log(grabCommand, "GrabSuccess", ELL_INFORMATION);\r
+//             os::Printer::log(grabCommand, "GrabSuccess", ELL_INFORMATION);\r
                return;\r
        }\r
 \r
        switch ( grabResult )\r
        {\r
                case AlreadyGrabbed:\r
-                       os::Printer::log(grabCommand, "AlreadyGrabbed", ELL_WARNING);\r
+                       os::Printer::log(grabCommand, "AlreadyGrabbed", ELL_WARNING);\r
                        break;\r
                case GrabNotViewable:\r
-                       os::Printer::log(grabCommand, "GrabNotViewable", ELL_WARNING);\r
+                       os::Printer::log(grabCommand, "GrabNotViewable", ELL_WARNING);\r
                        break;\r
                case GrabFrozen:\r
-                       os::Printer::log(grabCommand, "GrabFrozen", ELL_WARNING);\r
+                       os::Printer::log(grabCommand, "GrabFrozen", ELL_WARNING);\r
                        break;\r
                case GrabInvalidTime:\r
-                       os::Printer::log(grabCommand, "GrabInvalidTime", ELL_WARNING);\r
+                       os::Printer::log(grabCommand, "GrabInvalidTime", ELL_WARNING);\r
                        break;\r
                default:\r
-                       os::Printer::log(grabCommand, "grab failed with unknown problem", ELL_WARNING);\r
+                       os::Printer::log(grabCommand, "grab failed with unknown problem", ELL_WARNING);\r
                        break;\r
        }\r
 }\r
@@ -380,7 +380,7 @@ bool CIrrDeviceLinux::createWindow()
        }\r
 #ifdef _DEBUG\r
        else\r
-               os::Printer::log("Visual chosen", core::stringc(static_cast<u32>(VisualInfo->visualid)).c_str(), ELL_DEBUG);\r
+               os::Printer::log("Visual chosen", core::stringc(static_cast<u32>(VisualInfo->visualid)).c_str(), ELL_DEBUG);\r
 #endif\r
 \r
        // create color map\r
@@ -1796,7 +1796,7 @@ Bool PredicateIsEventType(Display *display, XEvent *event, XPointer arg)
 {\r
        if ( event && event->type == *(int*)arg )\r
        {\r
-//             os::Printer::log("remove event:", core::stringc((int)arg).c_str(), ELL_INFORMATION);\r
+//             os::Printer::log("remove event", core::stringc((int)arg).c_str(), ELL_INFORMATION);\r
                return True;\r
        }\r
        return False;\r
index 711cb564cd0fd731ebb65f58f49e8db7bc02994f..26683a72a347337fbe6c8dc80a4c5b6f3be3ce4b 100644 (file)
@@ -220,7 +220,7 @@ CIrrDeviceSDL::CIrrDeviceSDL(const SIrrlichtCreationParameters& param)
 #endif\r
                if (SDL_Init(flags) < 0)\r
                {\r
-                       os::Printer::log( "Unable to initialize SDL!", SDL_GetError());\r
+                       os::Printer::log("Unable to initialize SDL!", SDL_GetError());\r
                        Close = true;\r
                }\r
                else\r
@@ -447,7 +447,7 @@ bool CIrrDeviceSDL::createWindow()
        }\r
        if ( !Window )\r
        {\r
-               os::Printer::log( "Could not initialize display!" );\r
+               os::Printer::log("Could not initialize display!" );\r
                return false;\r
        }\r
 \r
index 740f8e5f4b213d88ecee634a0ee4793f29899e49..43ea51e08eb867832ec0a194399abbdee3353bd1 100644 (file)
@@ -224,7 +224,7 @@ IAnimatedMesh* COBJMeshFileLoader::createMesh(io::IReadFile* file)
                                        v.Pos = vertexBuffer[Idx[0]];\r
                                else\r
                                {\r
-                                       os::Printer::log("Invalid vertex index in this line:", wordBuffer.c_str(), ELL_ERROR);\r
+                                       os::Printer::log("Invalid vertex index in this line", wordBuffer.c_str(), ELL_ERROR);\r
                                        delete [] buf;\r
                                        return 0;\r
                                }\r
index f7cf1f05488cfaa704eab12df7a057d57ee1b896..75e2ca645a9f2b7d5e15c3540d7a36424cdf1675 100644 (file)
@@ -1134,27 +1134,27 @@ void CSkinnedMesh::finalize()
 \r
                if ( redundantPosKeys > 0 )\r
                {\r
-                       os::Printer::log("Skinned Mesh - redundant position frames kicked:", core::stringc(redundantPosKeys).c_str(), ELL_DEBUG);\r
+                       os::Printer::log("Skinned Mesh - redundant position frames kicked", core::stringc(redundantPosKeys).c_str(), ELL_DEBUG);\r
                }\r
                if ( unorderedPosKeys > 0 )\r
                {\r
-                       irr::os::Printer::log("Skinned Mesh - unsorted position frames kicked:", irr::core::stringc(unorderedPosKeys).c_str(), irr::ELL_DEBUG);\r
+                       irr::os::Printer::log("Skinned Mesh - unsorted position frames kicked", irr::core::stringc(unorderedPosKeys).c_str(), irr::ELL_DEBUG);\r
                }\r
                if ( redundantScaleKeys > 0 )\r
                {\r
-                       os::Printer::log("Skinned Mesh - redundant scale frames kicked:", core::stringc(redundantScaleKeys).c_str(), ELL_DEBUG);\r
+                       os::Printer::log("Skinned Mesh - redundant scale frames kicked", core::stringc(redundantScaleKeys).c_str(), ELL_DEBUG);\r
                }\r
                if ( unorderedScaleKeys > 0 )\r
                {\r
-                       irr::os::Printer::log("Skinned Mesh - unsorted scale frames kicked:", irr::core::stringc(unorderedScaleKeys).c_str(), irr::ELL_DEBUG);\r
+                       irr::os::Printer::log("Skinned Mesh - unsorted scale frames kicked", irr::core::stringc(unorderedScaleKeys).c_str(), irr::ELL_DEBUG);\r
                }\r
                if ( redundantRotationKeys > 0 )\r
                {\r
-                       os::Printer::log("Skinned Mesh - redundant rotation frames kicked:", core::stringc(redundantRotationKeys).c_str(), ELL_DEBUG);\r
+                       os::Printer::log("Skinned Mesh - redundant rotation frames kicked", core::stringc(redundantRotationKeys).c_str(), ELL_DEBUG);\r
                }\r
                if ( unorderedRotationKeys > 0 )\r
                {\r
-                       irr::os::Printer::log("Skinned Mesh - unsorted rotation frames kicked:", irr::core::stringc(unorderedRotationKeys).c_str(), irr::ELL_DEBUG);\r
+                       irr::os::Printer::log("Skinned Mesh - unsorted rotation frames kicked", irr::core::stringc(unorderedRotationKeys).c_str(), irr::ELL_DEBUG);\r
                }\r
        }\r
 \r
index 0d7ef42cdf1db8893a3066e6e8e4f19440b1b437..4cd6ea8b4a4c97a2dfe65c74485c1b04eee17c8c 100644 (file)
@@ -464,7 +464,7 @@ bool CWGLManager::activateContext(const SExposedVideoData& videoData, bool resto
        {\r
                if (!wglMakeCurrent((HDC)PrimaryContext.OpenGLWin32.HDc, (HGLRC)PrimaryContext.OpenGLWin32.HRc))\r
                {\r
-                       os::Printer::log("Render Context switch failed.");\r
+                       os::Printer::log("Render Context switch (back to main) failed.");\r
                        return false;\r
                }\r
                CurrentContext=PrimaryContext;\r
index 2a365ac16a9865661e6ba11f3efd5b8966774c3f..c06cd1772be66c85bbdfce03c5fa8dc84fda083f 100644 (file)
@@ -479,7 +479,7 @@ bool CXMeshFileLoader::parseDataObject()
 \r
        // parse specific object\r
 #ifdef _XREADER_DEBUG\r
-       os::Printer::log("debug DataObject:", objectName.c_str(), ELL_DEBUG);\r
+       os::Printer::log("debug DataObject", objectName.c_str(), ELL_DEBUG);\r
 #endif\r
 \r
        if (objectName == "template")\r
@@ -832,7 +832,7 @@ bool CXMeshFileLoader::parseDataObjectMesh(SXMesh &mesh)
                }\r
 \r
 #ifdef _XREADER_DEBUG\r
-               os::Printer::log("debug DataObject in mesh:", objectName.c_str(), ELL_DEBUG);\r
+               os::Printer::log("debug DataObject in mesh", objectName.c_str(), ELL_DEBUG);\r
 #endif\r
 \r
                if (objectName == "MeshNormals")\r
index c0aa83b083116af06908618df962acc4e53eae87..dc1a154a868116b6404fb804b0b515f02de27666 100644 (file)
@@ -38,6 +38,8 @@ namespace os
                static void print(const c8* message, ELOG_LEVEL ll = ELL_INFORMATION);\r
                static void log(const c8* message, ELOG_LEVEL ll = ELL_INFORMATION);\r
                static void log(const wchar_t* message, ELOG_LEVEL ll = ELL_INFORMATION);\r
+\r
+               // The string ": " is added between message and hint\r
                static void log(const c8* message, const c8* hint, ELOG_LEVEL ll = ELL_INFORMATION);\r
                static void log(const c8* message, const io::path& hint, ELOG_LEVEL ll = ELL_INFORMATION);\r
                static ILogger* Logger;\r