cliLog() public static method

.. methods.
public static cliLog ( $msg, $verbosity )
Exemplo n.º 1
0
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 */
require dirname(__FILE__) . '/_bootstrap.php';
// configure logger
JAXLLogger::$level = JAXLLogger::INFO;
// print usage notice and parse addr/port parameters if passed
JAXLLogger::cliLog("Usage: {$argv['0']} port (default: 9699)", JAXLLogger::NOTICE);
$port = $argc == 2 ? $argv[1] : 9699;
// initialize http server
$http = new HTTPServer($port);
// callback method for dispatch rule (see below)
function index($request)
{
    $request->send_response(200, array('Content-Type' => 'text/html'), '<html><head/><body><h1>Jaxl Http Server</h1><a href="/upload">upload a file</a></body></html>');
    $request->close();
}
// callback method for dispatch rule (see below)
function upload($request)
{
    if ($request->method == 'GET') {
        $request->ok(array('Content-Type' => 'text/html'), '<html><head/><body><h1>Jaxl Http Server</h1><form enctype="multipart/form-data" method="POST" ' . 'action="http://127.0.0.1:9699/upload/"><input type="file" name="file"/><input type="submit" ' . 'value="upload"/></form></body></html>');
    } elseif ($request->method == 'POST') {
Exemplo n.º 2
0
 public static function printHelp()
 {
     global $exe;
     JAXLLogger::cliLog("Usage: {$exe} command [options...]" . PHP_EOL, JAXLLogger::INFO);
     JAXLLogger::cliLog("Commands:", JAXLLogger::NOTICE);
     JAXLLogger::cliLog("    help      This help text", JAXLLogger::DEBUG);
     JAXLLogger::cliLog("    debug     Attach a debug console to a running JAXL daemon", JAXLLogger::DEBUG);
     JAXLLogger::cliLog("    shell     Open up Jaxl shell emulator", JAXLLogger::DEBUG);
     echo PHP_EOL;
 }