Shaka Player Embedded
console.h
Go to the documentation of this file.
1 // Copyright 2016 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef SHAKA_EMBEDDED_JS_CONSOLE_H_
16 #define SHAKA_EMBEDDED_JS_CONSOLE_H_
17 
18 #include <string>
19 
23 
24 namespace shaka {
25 namespace js {
26 
27 class Console : public BackingObject {
28  DECLARE_TYPE_INFO(Console);
29 
30  public:
31  enum LogLevel {
37  };
38 
39  Console();
40 
41  void Assert(Any cond, const CallbackArguments& arguments) const;
42  void Error(const CallbackArguments& arguments) const;
43  void Warn(const CallbackArguments& arguments) const;
44  void Info(const CallbackArguments& arguments) const;
45  void Log(const CallbackArguments& arguments) const;
46  void Debug(const CallbackArguments& arguments) const;
47 
52  static std::string ConvertToPrettyString(Handle<JsValue> value);
53 
54  private:
61  void LogReal(LogLevel level, const CallbackArguments& arguments,
62  const char* prefix = nullptr, size_t skip_count = 0) const;
63 };
64 
65 class ConsoleFactory : public BackingObjectFactory<Console> {
66  public:
68  ~ConsoleFactory() override {}
69 };
70 
71 } // namespace js
72 } // namespace shaka
73 
74 #endif // SHAKA_EMBEDDED_JS_CONSOLE_H_
Definition: any.h:31
~ConsoleFactory() override
Definition: console.h:68
void Info(const CallbackArguments &arguments) const
Definition: console.cc:223
void Warn(const CallbackArguments &arguments) const
Definition: console.cc:219
void Log(const CallbackArguments &arguments) const
Definition: console.cc:227
void Debug(const CallbackArguments &arguments) const
Definition: console.cc:231
void Error(const CallbackArguments &arguments) const
Definition: console.cc:215
static std::string ConvertToPrettyString(Handle< JsValue > value)
Definition: console.cc:235
void Assert(Any cond, const CallbackArguments &arguments) const
Definition: console.cc:208