Skip to content

Commit

Permalink
Log console messages
Browse files Browse the repository at this point in the history
Closes #46
  • Loading branch information
Ninja101 authored and jp9000 committed Mar 30, 2018
1 parent e6fb3a0 commit 22fe8ed
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
19 changes: 18 additions & 1 deletion shared/browser-client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/

#include <include/cef_render_handler.h>
#include <util/base.h>

#include "browser-client.hpp"
#include "browser-obs-bridge.hpp"
Expand All @@ -26,6 +26,11 @@ BrowserClient::BrowserClient(CefRenderHandler *renderHandler,
{
}

CefRefPtr<CefDisplayHandler> BrowserClient::GetDisplayHandler()
{
return this;
}

CefRefPtr<CefRenderHandler> BrowserClient::GetRenderHandler()
{
return renderHandler;
Expand Down Expand Up @@ -122,3 +127,15 @@ bool BrowserClient::OnProcessMessageReceived(
}
return false;
}

bool BrowserClient::OnConsoleMessage(CefRefPtr<CefBrowser> browser,
const CefString& message,
const CefString& source,
int line)
{
blog(LOG_INFO, "obs-browser: %s (source: %s:%d)",
message.ToString().c_str(),
source.ToString().c_str(),
line);
return false;
}
9 changes: 7 additions & 2 deletions shared/browser-client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ class BrowserRenderHandler;
class BrowserLoadHandler;

class BrowserClient : public CefClient, public CefLifeSpanHandler,
public CefContextMenuHandler
public CefContextMenuHandler, public CefDisplayHandler
{
public:
BrowserClient(CefRenderHandler *renderHandler,
CefLoadHandler *loadHandler,
BrowserOBSBridge *browserOBSBridge);

public: /* CefClient overrides */
virtual CefRefPtr<CefDisplayHandler> GetDisplayHandler() OVERRIDE;
virtual CefRefPtr<CefRenderHandler> GetRenderHandler() OVERRIDE;
virtual CefRefPtr<CefLifeSpanHandler> GetLifeSpanHandler() OVERRIDE;
virtual CefRefPtr<CefContextMenuHandler> GetContextMenuHandler()
Expand All @@ -58,7 +59,11 @@ class BrowserClient : public CefClient, public CefLifeSpanHandler,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefContextMenuParams> params,
CefRefPtr<CefMenuModel> model);

public: /* CefDisplayHandler overrides */
virtual bool OnConsoleMessage(CefRefPtr<CefBrowser> browser,
const CefString& message,
const CefString& source,
int line) OVERRIDE;
private:
CefRefPtr<CefRenderHandler> renderHandler;
CefRefPtr<CefLoadHandler> loadHandler;
Expand Down

0 comments on commit 22fe8ed

Please sign in to comment.